[llvm] [CodeGenPrepare] Folding `urem` with loop invariant value as remainder (PR #96625)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 08:47:54 PDT 2024


================
@@ -1974,6 +1975,161 @@ static bool foldFCmpToFPClassTest(CmpInst *Cmp, const TargetLowering &TLI,
   return true;
 }
 
+static bool isRemOfLoopIncrementWithLIV(Value *Rem, const LoopInfo *LI,
+                                        Value *&RemAmtOut,
+                                        std::optional<bool> &AddOrSubOut,
+                                        Value *&AddOrSubOffsetOut,
+                                        PHINode *&LoopIncrPNOut) {
+  Value *Incr, *RemAmt;
+  if (!isa<Instruction>(Rem))
+    return false;
----------------
goldsteinn wrote:

Is that necessary? We are trying to remove ConstantExpr and this doesn't seem so complex that it might fail.

https://github.com/llvm/llvm-project/pull/96625


More information about the llvm-commits mailing list