Fix bug: InstCombine/2003-06-05-BranchInvertInfLoop.ll
authorChris Lattner <sabre@nondot.org>
Thu, 5 Jun 2003 20:12:51 +0000 (20:12 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 5 Jun 2003 20:12:51 +0000 (20:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6630 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index cfeada349bd2b3088ea2494e85f29e2b07d07bcd..5d7881d68d29d6a7f432442523b13bd51e57ba78 100644 (file)
@@ -1072,7 +1072,7 @@ Instruction *InstCombiner::visitAllocationInst(AllocationInst &AI) {
 
 Instruction *InstCombiner::visitBranchInst(BranchInst &BI) {
   // Change br (not X), label True, label False to: br X, label False, True
-  if (BI.isConditional())
+  if (BI.isConditional() && !isa<Constant>(BI.getCondition()))
     if (Value *V = dyn_castNotVal(BI.getCondition())) {
       BasicBlock *TrueDest = BI.getSuccessor(0);
       BasicBlock *FalseDest = BI.getSuccessor(1);