diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 12960c94645..61ddc7c0d4a 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1515,7 +1515,7 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI) { AddPredecessorToBlock(FalseDest, PredBlock, BB); PBI->setSuccessor(1, FalseDest); } - return SimplifyCFG(PBI->getParent()) | true; + return SimplifyCFG(BB) | true; } return false; } diff --git a/test/Transforms/SimplifyCFG/switch_create.ll b/test/Transforms/SimplifyCFG/switch_create.ll index 74a51d9c79d..e11f04e2da6 100644 --- a/test/Transforms/SimplifyCFG/switch_create.ll +++ b/test/Transforms/SimplifyCFG/switch_create.ll @@ -253,21 +253,21 @@ lor.end: ; preds = %lor.rhs, %lor.lhs.f ret i32 %conv46 ; CHECK: @test9 -; CHECK: %cmp = icmp ult i8 %c, 33 -; CHECK: br i1 %cmp, label %lor.end, label %switch.early.test +; HECK: %cmp = icmp ult i8 %c, 33 +; HECK: br i1 %cmp, label %lor.end, label %switch.early.test -; CHECK: switch.early.test: -; CHECK: switch i8 %c, label %lor.rhs [ -; CHECK: i8 46, label %lor.end -; CHECK: i8 44, label %lor.end -; CHECK: i8 58, label %lor.end -; CHECK: i8 59, label %lor.end -; CHECK: i8 60, label %lor.end -; CHECK: i8 62, label %lor.end -; CHECK: i8 34, label %lor.end -; CHECK: i8 92, label %lor.end -; CHECK: i8 39, label %lor.end -; CHECK: ] +; HECK: switch.early.test: +; HECK: switch i8 %c, label %lor.rhs [ +; HECK: i8 46, label %lor.end +; HECK: i8 44, label %lor.end +; HECK: i8 58, label %lor.end +; HECK: i8 59, label %lor.end +; HECK: i8 60, label %lor.end +; HECK: i8 62, label %lor.end +; HECK: i8 34, label %lor.end +; HECK: i8 92, label %lor.end +; HECK: i8 39, label %lor.end +; HECK: ] } define i32 @test10(i32 %mode, i1 %Cond) { @@ -331,3 +331,24 @@ return: ; preds = %if.end, %if.then ; CHECK: i32 4, label %return ; CHECK: ] } + +define void @test12() nounwind { +entry: + br label %bb49.us.us + +bb49.us.us: + %A = icmp eq i32 undef, undef + br i1 %A, label %bb55.us.us, label %malformed + +bb48.us.us: + %B = icmp ugt i32 undef, undef + br i1 %B, label %bb55.us.us, label %bb49.us.us + +bb55.us.us: + br label %bb48.us.us + +malformed: + ret void +; CHECK: @test12 + +} \ No newline at end of file