[llvm-commits] [llvm] r121733 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch_create.ll

Owen Anderson resistor at mac.com
Mon Dec 13 15:49:28 PST 2010


Author: resistor
Date: Mon Dec 13 17:49:28 2010
New Revision: 121733

URL: http://llvm.org/viewvc/llvm-project?rev=121733&view=rev
Log:
Fix recent buildbot breakage by pulling SimplifyCFG back to its state as of r121694, the most recent state
where I'm confident there were no crashes or miscompilations.  XFAIL the test added since then for now.

Modified:
    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
    llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=121733&r1=121732&r2=121733&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Mon Dec 13 17:49:28 2010
@@ -1515,7 +1515,7 @@
       AddPredecessorToBlock(FalseDest, PredBlock, BB);
       PBI->setSuccessor(1, FalseDest);
     }
-    return SimplifyCFG(BB) | true;
+    return SimplifyCFG(PBI->getParent()) | true;
   }
   return false;
 }
@@ -1905,25 +1905,17 @@
   
   BasicBlock *BB = BI->getParent();
   
-  DEBUG(dbgs() << "CONVERTING 'icmp' CHAIN with " << Values.size()
-               << " cases into SWITCH.  BB is:\n" << *BB);
-  
   // If there are any extra values that couldn't be folded into the switch
   // then we evaluate them with an explicit branch first.  Split the block
   // right before the condbr to handle it.
   if (ExtraCase) {
-    DEBUG(dbgs() << "  ** 'icmp' chain unhandled condition: " << *ExtraCase
-                 << '\n');
+    return false;
     
     BasicBlock *NewBB = BB->splitBasicBlock(BI, "switch.early.test");
     // Remove the uncond branch added to the old block.
     TerminatorInst *OldTI = BB->getTerminator();
     
-    if (TrueWhenEqual)
-      BranchInst::Create(EdgeBB, NewBB, ExtraCase, OldTI);
-    else
-      BranchInst::Create(NewBB, EdgeBB, ExtraCase, OldTI);
-      
+    BranchInst::Create(EdgeBB, NewBB, ExtraCase, OldTI);
     OldTI->eraseFromParent();
     
     // If there are PHI nodes in EdgeBB, then we need to add a new entry to them
@@ -1963,7 +1955,6 @@
   
   // Erase the old branch instruction.
   EraseTerminatorInstAndDCECond(BI);
-  
   return true;
 }
 
@@ -2367,7 +2358,7 @@
   // branches to us and one of our successors, fold the setcc into the
   // predecessor and use logical operations to pick the right destination.
   if (FoldBranchToCommonDest(BI))
-    return true;
+    return SimplifyCFG(BB) | true;
   
   // Scan predecessor blocks for conditional branches.
   for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
@@ -2419,7 +2410,8 @@
     if (BI->isUnconditional()) {
       if (SimplifyUncondBranch(BI)) return true;
     } else {
-      if (SimplifyCondBranch(BI)) return true;
+      if (SimplifyCondBranch(BI))
+        return true;
     }
   } else if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator())) {
     if (SimplifyReturn(RI)) return true;

Modified: llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll?rev=121733&r1=121732&r2=121733&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll Mon Dec 13 17:49:28 2010
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -simplifycfg -S | FileCheck %s
+; XFAIL: *
 
 declare void @foo1()
 





More information about the llvm-commits mailing list