If BB is predicated, invalidate its predecessor(s) which would if-convert it. It...
authorEvan Cheng <evan.cheng@apple.com>
Thu, 14 Jun 2007 23:13:19 +0000 (23:13 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 14 Jun 2007 23:13:19 +0000 (23:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37580 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/IfConversion.cpp

index 87340d37005d0bd4daaa709992323f8fb61ce740..b1aa31a28e3d8f84612e66bc61775468ac43ffb4 100644 (file)
@@ -656,15 +656,19 @@ static bool canFallThroughTo(MachineBasicBlock *BB, MachineBasicBlock *ToBB) {
 }
 
 /// ReTryPreds - Invalidate predecessor BB info so it would be re-analyzed
-/// to determine if it can be if-converted.
+/// to determine if it can be if-converted. If predecessor is already
+/// enqueud, dequeue it!
 void IfConverter::ReTryPreds(MachineBasicBlock *BB) {
   for (MachineBasicBlock::pred_iterator PI = BB->pred_begin(),
          E = BB->pred_end(); PI != E; ++PI) {
     BBInfo &PBBI = BBAnalysis[(*PI)->getNumber()];
-    if (!PBBI.IsDone && PBBI.Kind == ICNotClassfied) {
+    if (PBBI.IsDone)
+      continue;
+    if (PBBI.Kind == ICNotClassfied) {
       assert(!PBBI.IsEnqueued && "Unexpected");
       PBBI.IsAnalyzed = false;
-    }
+    } else if (PBBI.IsEnqueued && PBBI.BB != BB)
+      PBBI.IsEnqueued = false;
   }
 }