diff options
author | Dehao Chen <dehao@google.com> | 2017-08-16 01:55:26 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-08-16 01:55:26 +0000 |
commit | 84d412035a05c218f5814eb0635dddf750ff9978 (patch) | |
tree | fdc23964d4a216208b0e3bd9ef14c6f0e8c06519 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | ccfc80ccc7a61cbd262e33b5c69236f7e5440dae (diff) | |
download | bcm5719-llvm-84d412035a05c218f5814eb0635dddf750ff9978.tar.gz bcm5719-llvm-84d412035a05c218f5814eb0635dddf750ff9978.zip |
Merge debug info when hoist then-else code to if.
Summary: When we move then-else code to if, we need to merge its debug info, otherwise the hoisted instruction may have inaccurate debug info attached.
Reviewers: aprantl, probinson, dblaikie, echristo, loladiro
Reviewed By: aprantl
Subscribers: sanjoy, llvm-commits
Differential Revision: https://reviews.llvm.org/D36778
llvm-svn: 310985
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 1204a94a32a..55897cc507b 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1336,6 +1336,8 @@ HoistTerminator: I2->replaceAllUsesWith(NT); NT->takeName(I1); } + NT->setDebugLoc(DILocation::getMergedLocation( + I1->getDebugLoc(), I2->getDebugLoc())); IRBuilder<NoFolder> Builder(NT); // Hoisting one of the terminators from our successor is a great thing. |