[llvm] [IndVarSimplify] Allow predicateLoopExit on some loops with thread-local writes (PR #155901)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 01:18:54 PDT 2025


================
@@ -1840,6 +1880,23 @@ bool IndVarSimplify::predicateLoopExits(Loop *L, SCEVExpander &Rewriter) {
     const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
 
     auto *BI = cast<BranchInst>(ExitingBB->getTerminator());
+    if (HasThreadLocalSideEffects) {
+      const BasicBlock *Unreachable = nullptr;
+      const BasicBlock *InLoop = nullptr;
----------------
nikic wrote:

Why do we need InLoop? You only seem to check that it exists, but that's a given for a loop exit.

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


More information about the llvm-commits mailing list