aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-04 22:19:42 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-04 22:19:42 +0000
commit8e0f8b8c96c8b0cf053dbf78cba1d534f05c99a2 (patch)
tree2173cb011a5acb1fa9d98fcd6a549fec31595377 /contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parentd8c03e73dcf4987b182e9ba75540b289daaffc06 (diff)
parent0c75eea8f661a82866688fd1fc4465883c4dd7d5 (diff)
Notes
Diffstat (limited to 'contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 3846b21c502e..54390e77bb1f 100644
--- a/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1574,12 +1574,20 @@ static bool sinkLastInstruction(ArrayRef<BasicBlock*> Blocks) {
I0->getOperandUse(O).set(NewOperands[O]);
I0->moveBefore(&*BBEnd->getFirstInsertionPt());
- // Update metadata and IR flags.
+ // The debug location for the "common" instruction is the merged locations of
+ // all the commoned instructions. We start with the original location of the
+ // "common" instruction and iteratively merge each location in the loop below.
+ DILocation *Loc = I0->getDebugLoc();
+
+ // Update metadata and IR flags, and merge debug locations.
for (auto *I : Insts)
if (I != I0) {
+ Loc = DILocation::getMergedLocation(Loc, I->getDebugLoc());
combineMetadataForCSE(I0, I);
I0->andIRFlags(I);
}
+ if (!isa<CallInst>(I0))
+ I0->setDebugLoc(Loc);
if (!isa<StoreInst>(I0)) {
// canSinkLastInstruction checked that all instructions were used by