summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LICM.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2019-04-19 22:36:40 +0000
committerVedant Kumar <vsk@apple.com>2019-04-19 22:36:40 +0000
commit282b26ec4d988fe300cda4d8f273a42cf4e0923d (patch)
tree6f2c114275bcb5fd8137c3bdd5a3191f9df5b352 /llvm/lib/Transforms/Scalar/LICM.cpp
parenta9c2ba3fffa575cd6eeb81cdecd461d2e9b1c09b (diff)
downloadbcm5719-llvm-282b26ec4d988fe300cda4d8f273a42cf4e0923d.tar.gz
bcm5719-llvm-282b26ec4d988fe300cda4d8f273a42cf4e0923d.zip
[GVN+LICM] Use line 0 locations for better crash attribution
This is a follow-up to r291037+r291258, which used null debug locations to prevent jumpy line tables. Using line 0 locations achieves the same effect, but works better for crash attribution because it preserves the right inline scope. Differential Revision: https://reviews.llvm.org/D60913 llvm-svn: 358791
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LICM.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 31841773375..dcbf2d42c54 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -54,6 +54,7 @@
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
@@ -1652,13 +1653,10 @@ static void hoist(Instruction &I, const DominatorTree *DT, const Loop *CurLoop,
// Move the new node to the destination block, before its terminator.
moveInstructionBefore(I, *Dest->getTerminator(), *SafetyInfo, MSSAU);
- // Do not retain debug locations when we are moving instructions to different
- // basic blocks, because we want to avoid jumpy line tables. Calls, however,
- // need to retain their debug locs because they may be inlined.
- // FIXME: How do we retain source locations without causing poor debugging
- // behavior?
- if (!isa<CallInst>(I))
- I.setDebugLoc(DebugLoc());
+ // Apply line 0 debug locations when we are moving instructions to different
+ // basic blocks because we want to avoid jumpy line tables.
+ if (const DebugLoc &DL = I.getDebugLoc())
+ I.setDebugLoc(DebugLoc::get(0, 0, DL.getScope(), DL.getInlinedAt()));
if (isa<LoadInst>(I))
++NumMovedLoads;
OpenPOWER on IntegriCloud