[llvm] [SimplifyCFG] Mark div/rem as not-cheap to sink if we are replacing const denominator (PR #109007)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 17 09:14:49 PDT 2024
================
@@ -1954,6 +1954,16 @@ static bool isLifeTimeMarker(const Instruction *I) {
// into variables.
static bool replacingOperandWithVariableIsCheap(const Instruction *I,
int OpIdx) {
+ switch (I->getOpcode()) {
+ // Divide/Remainder by constant is typically much cheaper than by variable.
----------------
nikic wrote:
You can use `I->isIntDivRem()` here.
https://github.com/llvm/llvm-project/pull/109007
More information about the llvm-commits
mailing list