[llvm] (Draft) [SimplifyIndVar] Push more users to worklist for simplifyUsers (PR #93598)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 00:01:04 PDT 2024


================
@@ -511,6 +511,7 @@ bool SimplifyIndvar::eliminateTrunc(TruncInst *TI) {
     ICmpInst *ICI = dyn_cast<ICmpInst>(U);
     if (!ICI) return false;
     assert(L->contains(ICI->getParent()) && "LCSSA form broken?");
+    //    assert(L->contains(ICI->getParent()) && "LCSSA form broken?");
----------------
v01dXYZ wrote:

It seems to me the utility class `SimplifyIndVar` don't have to be fed LCSSA-normalised loop but the loop pass `IndVarSimplify` needs it (I don't know exactly all the reasons, just spotted it uses `llvm::rewriteExitValue` which simply uses the Backedge Info + SCEV to replace the LCSSA phis with SCEV Constant if the phi is a SCEV Add Rec)

Maybe I'm making a mistake but `eliminateTrunc` checks all the `trunc` users are `icmp` that are eligible to simplifications. I don't see why the LCSSA is required here (except to ensure staying inside the loop).

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


More information about the llvm-commits mailing list