diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 1a4820e..c63618d 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1954,6 +1954,9 @@ static bool isLifeTimeMarker(const Instruction *I) { // into variables. static bool replacingOperandWithVariableIsCheap(const Instruction *I, int OpIdx) { + // Divide/Remainder by constant is typically much cheaper than by variable. + if (I->isIntDivRem()) + return OpIdx != 1; return !isa<IntrinsicInst>(I); } |
