summaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
index 939c36164f78..bd7895feb64a 100644
--- a/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
@@ -85,8 +85,11 @@ static bool replaceConditionalBranchesOnConstant(Instruction *II,
if (Target && Target != Other) {
BasicBlock *Source = BI->getParent();
Other->removePredecessor(Source);
+
+ Instruction *NewBI = BranchInst::Create(Target, Source);
+ NewBI->setDebugLoc(BI->getDebugLoc());
BI->eraseFromParent();
- BranchInst::Create(Target, Source);
+
if (DTU)
DTU->applyUpdates({{DominatorTree::Delete, Source, Other}});
if (pred_empty(Other))