From 10038ab095f12163c52b06ea4479eb4622a0fb57 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 8 May 2009 09:35:53 +0000 Subject: [PATCH] Reverse branch condition only when there is a conditional branch. llvm-svn: 71214 --- lib/CodeGen/CodePlacementOpt.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/CodePlacementOpt.cpp b/lib/CodeGen/CodePlacementOpt.cpp index f6a8421c434..4276651d3bc 100644 --- a/lib/CodeGen/CodePlacementOpt.cpp +++ b/lib/CodeGen/CodePlacementOpt.cpp @@ -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;