summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-09-29 00:30:19 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-09-29 00:30:19 +0000
commitd8b86f7cdc97abe2f3f25e2e535e6e21811bf381 (patch)
tree94dfe61390e8de08f62a1ff87d5d0bd3fd874f07 /llvm/lib/Transforms/Utils/Local.cpp
parente211e204da3afd42dcb544a865a0930b04bd779b (diff)
downloadbcm5719-llvm-d8b86f7cdc97abe2f3f25e2e535e6e21811bf381.tar.gz
bcm5719-llvm-d8b86f7cdc97abe2f3f25e2e535e6e21811bf381.zip
Move dbg.declare intrinsics when merging and replacing allocas.
Place new and update dbg.declare calls immediately after the corresponding alloca. Current code in replaceDbgDeclareForAlloca puts the new dbg.declare at the end of the basic block. LLVM codegen has problems emitting debug info in a situation when dbg.declare appears after all uses of the variable. This usually kinda works for inlining and ASan (two users of this function) but not for SafeStack (see the pending change in http://reviews.llvm.org/D13178). llvm-svn: 248769
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 5efa128090f..adee3f6c985 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1157,10 +1157,10 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
DIExpr = Builder.createExpression(NewDIExpr);
}
- // Insert llvm.dbg.declare in the same basic block as the original alloca,
- // and remove old llvm.dbg.declare.
- BasicBlock *BB = AI->getParent();
- Builder.insertDeclare(NewAllocaAddress, DIVar, DIExpr, Loc, BB);
+ // Insert llvm.dbg.declare immediately after the original alloca, and remove
+ // old llvm.dbg.declare.
+ Builder.insertDeclare(NewAllocaAddress, DIVar, DIExpr, Loc,
+ AI->getNextNode());
DDI->eraseFromParent();
return true;
}
OpenPOWER on IntegriCloud