[llvm] [LoopFlatten] Invalidate SCEV on unflattening bail (PR #211819)

Arda Serdar Pektezol via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 01:54:01 PDT 2026


================

----------------
pektezol wrote:

Ah I see, so it's better to move this under CanWidenIV before canflatten?
```cpp
  // Save the old/narrow induction phis, which we need to ignore in CheckPHIs.
  FI.NarrowInnerInductionPHI = FI.InnerInductionPHI;
  FI.NarrowOuterInductionPHI = FI.OuterInductionPHI;

  SE->forgetLoop(FI.OuterLoop);
  SE->forgetBlockAndLoopDispositions();

  // After widening, rediscover all the loop components.
  return CanFlattenLoopPair(FI, DT, LI, SE, AC, TTI);
}
```

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


More information about the llvm-commits mailing list