[llvm] d34661b - [LPM][LegacyPM] Reenable LCSSA Verification

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 19 12:02:29 PDT 2026


Author: Aiden Grossman
Date: 2026-04-19T12:02:24-07:00
New Revision: d34661b89c7978b28005811c557ca8aca1a23d0d

URL: https://github.com/llvm/llvm-project/commit/d34661b89c7978b28005811c557ca8aca1a23d0d
DIFF: https://github.com/llvm/llvm-project/commit/d34661b89c7978b28005811c557ca8aca1a23d0d.diff

LOG: [LPM][LegacyPM] Reenable LCSSA Verification

This was disabled about a decade ago due to issues with LoopSink.
LoopSink has since had its LegacyPM version removed and is now a
function pass due to not needing too much loop infrastructure. So we can
try enabling this again to prevent backsliding on important cases while
we work on switching to the NewPM which does enforce these things.

Eventually we will want to add assertions here for LoopStrengthReduce,
but given it does not correctly preserve LCSSA, postpone that for now.

Reviewers: arsenm, Meinersbur, nikic, fhahn

Pull Request: https://github.com/llvm/llvm-project/pull/191667

Added: 
    

Modified: 
    llvm/lib/Analysis/LoopPass.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp
index d8680aac74b22..85c15c5721cd6 100644
--- a/llvm/lib/Analysis/LoopPass.cpp
+++ b/llvm/lib/Analysis/LoopPass.cpp
@@ -130,7 +130,7 @@ bool LPPassManager::runOnFunction(Function &F) {
   auto &LIWP = getAnalysis<LoopInfoWrapperPass>();
   LI = &LIWP.getLoopInfo();
   Module &M = *F.getParent();
-#if 0
+#ifndef NDEBUG
   DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
 #endif
   bool Changed = false;
@@ -239,9 +239,7 @@ bool LPPassManager::runOnFunction(Function &F) {
         // is that LPPassManager might run passes which do not require LCSSA
         // form (LoopPassPrinter for example). We should skip verification for
         // such passes.
-        // FIXME: Loop-sink currently break LCSSA. Fix it and reenable the
-        // verification!
-#if 0
+#ifndef NDEBUG
         if (mustPreserveAnalysisID(LCSSAVerificationPass::ID))
           assert(CurrentLoop->isRecursivelyLCSSAForm(*DT, *LI));
 #endif


        


More information about the llvm-commits mailing list