diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 456ad2a62b7e..1c27bc67cfbf 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1678,8 +1678,8 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB, Value *TrueV = ThenV, *FalseV = OrigV; if (Invert) std::swap(TrueV, FalseV); - Value *V = Builder.CreateSelect(BrCond, TrueV, FalseV, - TrueV->getName() + "." + FalseV->getName()); + Value *V = Builder.CreateSelect( + BrCond, TrueV, FalseV, TrueV->getName() + "." + FalseV->getName(), BI); PN->setIncomingValue(OrigI, V); PN->setIncomingValue(ThenI, V); } diff --git a/llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll b/llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll index 56474ce71899..1e9aa6b48f6b 100644 --- a/llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll +++ b/llvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll @@ -6,7 +6,7 @@ define i1 @qux(i8* %m, i8* %n, i8* %o, i8* %p) nounwind { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i8* %m, %n ; CHECK-NEXT: [[TMP15:%.*]] = icmp eq i8* %o, %p -; CHECK-NEXT: [[TMP15_:%.*]] = select i1 [[TMP7]], i1 [[TMP15]], i1 false +; CHECK-NEXT: [[TMP15_:%.*]] = select i1 [[TMP7]], i1 [[TMP15]], i1 false, !prof !0 ; CHECK-NEXT: ret i1 [[TMP15_]] ; entry: