From 84d412035a05c218f5814eb0635dddf750ff9978 Mon Sep 17 00:00:00 2001 From: Dehao Chen Date: Wed, 16 Aug 2017 01:55:26 +0000 Subject: 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 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp') 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 Builder(NT); // Hoisting one of the terminators from our successor is a great thing. -- cgit v1.2.3