diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2018-11-02 18:25:41 +0000 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2018-11-02 18:25:41 +0000 |
commit | 80e7e86c2999f90be7730036479c5418c059d336 (patch) | |
tree | 4b0e344bc0b4ffa5c45e056c2bbf650fab2e0ce5 /llvm/lib | |
parent | 5f7cb79e94e6ad4f34efe1f074956b7aaa05eaef (diff) | |
download | bcm5719-llvm-80e7e86c2999f90be7730036479c5418c059d336.tar.gz bcm5719-llvm-80e7e86c2999f90be7730036479c5418c059d336.zip |
[DebugInfo][InstMerge] Fix -debugify for phi node created by -mldst-motion
Summary:
-mldst-motion creates a new phi node without any debug info. Use the merged debug location from the incoming stores to fix this.
Fixes PR38177. The test case here is (somewhat) simplified from:
```
struct S {
int foo;
void fn(int bar);
};
void S::fn(int bar) {
if (bar)
foo = 1;
else
foo = 0;
}
```
Reviewers: dblaikie, gbedwell, aprantl, vsk
Reviewed By: vsk
Subscribers: vsk, JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D54019
llvm-svn: 346027
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp b/llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp index 3464b759280..ee21feca8d2 100644 --- a/llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp +++ b/llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp @@ -211,6 +211,7 @@ PHINode *MergedLoadStoreMotion::getPHIOperand(BasicBlock *BB, StoreInst *S0, auto *NewPN = PHINode::Create(Opd1->getType(), 2, Opd2->getName() + ".sink", &BB->front()); + NewPN->applyMergedLocation(S0->getDebugLoc(), S1->getDebugLoc()); NewPN->addIncoming(Opd1, S0->getParent()); NewPN->addIncoming(Opd2, S1->getParent()); return NewPN; |