[llvm] r324445 - Follow-up for r324429: "[LCSSAVerification] Run verification only when asserts are enabled."

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 20:24:44 PST 2018


Author: mzolotukhin
Date: Tue Feb  6 20:24:44 2018
New Revision: 324445

URL: http://llvm.org/viewvc/llvm-project?rev=324445&view=rev
Log:
Follow-up for r324429: "[LCSSAVerification] Run verification only when asserts are enabled."

Before r324429 we essentially didn't have a verification of LCSSA, so
no wonder that it has been broken: currently loop-sink breaks it (the
attached test illustrates the failure).

It was detected during a stage2 RA build, so to unbreak it I'm disabling
the check for now.

Modified:
    llvm/trunk/lib/Analysis/LoopPass.cpp
    llvm/trunk/test/Transforms/LICM/loopsink.ll

Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=324445&r1=324444&r2=324445&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Tue Feb  6 20:24:44 2018
@@ -151,7 +151,7 @@ void LPPassManager::markLoopAsDeleted(Lo
 bool LPPassManager::runOnFunction(Function &F) {
   auto &LIWP = getAnalysis<LoopInfoWrapperPass>();
   LI = &LIWP.getLoopInfo();
-#ifndef NDEBUG
+#if 0
   DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
 #endif
   bool Changed = false;
@@ -227,8 +227,12 @@ bool LPPassManager::runOnFunction(Functi
         // 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
         if (mustPreserveAnalysisID(LCSSAVerificationPass::ID))
           assert(CurrentLoop->isRecursivelyLCSSAForm(*DT, *LI));
+#endif
 
         // Then call the regular verifyAnalysis functions.
         verifyPreservedAnalysis(P);

Modified: llvm/trunk/test/Transforms/LICM/loopsink.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/loopsink.ll?rev=324445&r1=324444&r2=324445&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LICM/loopsink.ll (original)
+++ llvm/trunk/test/Transforms/LICM/loopsink.ll Tue Feb  6 20:24:44 2018
@@ -437,7 +437,68 @@ define i32 @t7(i32, i32) #0 !prof !0 {
   ret i32 10
 }
 
+%a = type { i8 }
+
+; CHECK-LABEL: @t8
+; CHECK: ret void
+define void @t8() !prof !0 {
+bb:
+  br label %bb1
+
+bb1:                                              ; preds = %bb
+  %tmp = getelementptr inbounds %a, %a* undef, i64 0, i32 0
+  br label %bb2
+
+bb2:                                              ; preds = %bb16, %bb1
+  br i1 undef, label %bb16, label %bb3
+
+bb3:                                              ; preds = %bb2
+  br i1 undef, label %bb16, label %bb4
+
+bb4:                                              ; preds = %bb3
+  br i1 undef, label %bb5, label %bb16
+
+bb5:                                              ; preds = %bb4
+  br i1 undef, label %bb16, label %bb6
+
+bb6:                                              ; preds = %bb5
+  br i1 undef, label %bb16, label %bb7
+
+bb7:                                              ; preds = %bb15, %bb6
+  br i1 undef, label %bb8, label %bb16
+
+bb8:                                              ; preds = %bb7
+  br i1 undef, label %bb9, label %bb15
+
+bb9:                                              ; preds = %bb8
+  br i1 undef, label %bb10, label %bb15
+
+bb10:                                             ; preds = %bb9
+  br i1 undef, label %bb11, label %bb15
+
+bb11:                                             ; preds = %bb10
+  br i1 undef, label %bb12, label %bb15
+
+bb12:                                             ; preds = %bb11
+  %tmp13 = load i8, i8* %tmp, align 8
+  br i1 undef, label %bb15, label %bb14
+
+bb14:                                             ; preds = %bb12
+  call void @bar(i8* %tmp)
+  br label %bb16
+
+bb15:                                             ; preds = %bb12, %bb11, %bb10, %bb9, %bb8
+  br i1 undef, label %bb16, label %bb7
+
+bb16:                                             ; preds = %bb15, %bb14, %bb7, %bb6, %bb5, %bb4, %bb3, %bb2
+  br i1 undef, label %bb17, label %bb2
+
+bb17:                                             ; preds = %bb16
+  ret void
+}
+
 declare i32 @foo()
+declare void @bar(i8*)
 
 !0 = !{!"function_entry_count", i64 1}
 !1 = !{!"branch_weights", i32 1, i32 2000}




More information about the llvm-commits mailing list