diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2018-08-24 20:42:32 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2018-08-24 20:42:32 +0000 |
commit | 59de37ba6c9ef34b089d5c1f7ad90bace6342091 (patch) | |
tree | bf6925f360b7ecfce7693e5d0ba9e22f92a2d535 /llvm/lib/CodeGen/SafeStack.cpp | |
parent | 29729f152960f32fa73b0d350c6ea5ed96e61850 (diff) | |
download | bcm5719-llvm-59de37ba6c9ef34b089d5c1f7ad90bace6342091.tar.gz bcm5719-llvm-59de37ba6c9ef34b089d5c1f7ad90bace6342091.zip |
[SafeStack] Set debug location for calls to __safestack_pointer_address.
Otherwise, the debug info is incorrect. On its own, this is mostly
harmless, but the safe-stack also later inlines the call to
__safestack_pointer_address, which leads to debug info with the wrong
scope, which eventually causes an assertion failure (and incorrect debug
info in release mode).
Differential Revision: https://reviews.llvm.org/D51075
llvm-svn: 340651
Diffstat (limited to 'llvm/lib/CodeGen/SafeStack.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SafeStack.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp index cbbbf7c385a..60e2ddf0a3d 100644 --- a/llvm/lib/CodeGen/SafeStack.cpp +++ b/llvm/lib/CodeGen/SafeStack.cpp @@ -775,6 +775,10 @@ bool SafeStack::run() { ++NumUnsafeStackRestorePointsFunctions; IRBuilder<> IRB(&F.front(), F.begin()->getFirstInsertionPt()); + // Calls must always have a debug location, or else inlining breaks. So + // we explicitly set a artificial debug location here. + if (DISubprogram *SP = F.getSubprogram()) + IRB.SetCurrentDebugLocation(DebugLoc::get(SP->getScopeLine(), 0, SP)); if (SafeStackUsePointerAddress) { Value *Fn = F.getParent()->getOrInsertFunction( "__safestack_pointer_address", StackPtrTy->getPointerTo(0)); |