[llvm] [indvars] Missing variables at Og: (PR #69920)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 00:01:46 PDT 2023


================
@@ -1519,6 +1520,31 @@ int llvm::rewriteLoopExitValues(Loop *L, LoopInfo *LI, TargetLibraryInfo *TLI,
   // The insertion point instruction may have been deleted; clear it out
   // so that the rewriter doesn't trip over it later.
   Rewriter.clearInsertPoint();
+
+  // The loop exit values have been updated; insert the debug location
+  // for the induction variable with its final value.
+  if (PHINode *IndVar = L->getInductionVariable(*SE)) {
----------------
nikic wrote:

This is still the wrong place to do this. You are updating just a single "induction variable" here, while the code can rewrite multiple, and can also use different exit values for different blocks. This adjustment should be above in the `// Transformation.` loop, which has all the induction phis and their replacement values.

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


More information about the llvm-commits mailing list