Reverse branch condition only when there is a conditional branch.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 8 May 2009 09:35:53 +0000 (09:35 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 8 May 2009 09:35:53 +0000 (09:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71214 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodePlacementOpt.cpp

index f6a8421c43480a69486bb4832ee62a555334aa1b..4276651d3bc80a2d30b589df627d4bfd36eeac29 100644 (file)
@@ -211,7 +211,8 @@ bool CodePlacementOpt::OptimizeIntraLoopEdges() {
         } else if (!FBB && SSMBB == TBB && Cond.empty()) {
           TBB = 0;
           --Cost;
-        } else if (!TII->ReverseBranchCondition(Cond)) {
+        } else if (!Cond.empty() && !TII->ReverseBranchCondition(Cond)) {
+          assert(SSMBB == TBB);
           TBB = FBB;
           FBB = 0;
           --Cost;