summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-09-21 12:07:33 +0000
committerDaniel Jasper <djasper@google.com>2017-09-21 12:07:33 +0000
commit7d2f38d6006619721a037d31ef9a8459ad2a9be1 (patch)
tree7df78ceff2f31c63602e62d82066569836984c94 /llvm/lib/CodeGen/SelectionDAG
parent582e141007b7de9e5174e9e42fd19e9ae44689ed (diff)
downloadbcm5719-llvm-7d2f38d6006619721a037d31ef9a8459ad2a9be1.tar.gz
bcm5719-llvm-7d2f38d6006619721a037d31ef9a8459ad2a9be1.zip
Revert r313825: "[IR] Add llvm.dbg.addr, a control-dependent version of llvm.dbg.declare"
.. as well as the two subsequent changes r313826 and r313875. This leads to segfaults in combination with ASAN. Will forward repro instructions to the original author (rnk). llvm-svn: 313876
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp48
1 files changed, 19 insertions, 29 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index a98be560860..fb32487ac42 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -5109,48 +5109,37 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
DAG.setRoot(CallResult.second);
return nullptr;
}
- case Intrinsic::dbg_addr:
case Intrinsic::dbg_declare: {
- const DbgInfoIntrinsic &DI = cast<DbgInfoIntrinsic>(I);
+ const DbgDeclareInst &DI = cast<DbgDeclareInst>(I);
DILocalVariable *Variable = DI.getVariable();
DIExpression *Expression = DI.getExpression();
+ const Value *Address = DI.getAddress();
assert(Variable && "Missing variable");
+ if (!Address) {
+ DEBUG(dbgs() << "Dropping debug info for " << DI << "\n");
+ return nullptr;
+ }
// Check if address has undef value.
- const Value *Address = DI.getVariableLocation();
- if (!Address || isa<UndefValue>(Address) ||
+ if (isa<UndefValue>(Address) ||
(Address->use_empty() && !isa<Argument>(Address))) {
DEBUG(dbgs() << "Dropping debug info for " << DI << "\n");
return nullptr;
}
- bool isParameter = Variable->isParameter() || isa<Argument>(Address);
-
- // Check if this variable can be described by a frame index, typically
- // either as a static alloca or a byval parameter.
- int FI = INT_MAX;
+ // Static allocas are handled more efficiently in the variable frame index
+ // side table.
if (const auto *AI =
- dyn_cast<AllocaInst>(Address->stripInBoundsConstantOffsets())) {
- if (AI->isStaticAlloca()) {
- auto I = FuncInfo.StaticAllocaMap.find(AI);
- if (I != FuncInfo.StaticAllocaMap.end())
- FI = I->second;
- }
- } else if (const auto *Arg = dyn_cast<Argument>(
- Address->stripInBoundsConstantOffsets())) {
- FI = FuncInfo.getArgumentFrameIndex(Arg);
- }
+ dyn_cast<AllocaInst>(Address->stripInBoundsConstantOffsets()))
+ if (AI->isStaticAlloca() && FuncInfo.StaticAllocaMap.count(AI))
+ return nullptr;
- // llvm.dbg.addr is control dependent and always generates indirect
- // DBG_VALUE instructions. llvm.dbg.declare is handled as a frame index in
- // the MachineFunction variable table.
- if (FI != INT_MAX) {
- if (Intrinsic == Intrinsic::dbg_addr)
- DAG.AddDbgValue(DAG.getFrameIndexDbgValue(Variable, Expression, FI, dl,
- SDNodeOrder),
- getRoot().getNode(), isParameter);
- return nullptr;
- }
+ // Byval arguments with frame indices were already handled after argument
+ // lowering and before isel.
+ if (const auto *Arg =
+ dyn_cast<Argument>(Address->stripInBoundsConstantOffsets()))
+ if (FuncInfo.getArgumentFrameIndex(Arg) != INT_MAX)
+ return nullptr;
SDValue &N = NodeMap[Address];
if (!N.getNode() && isa<Argument>(Address))
@@ -5161,6 +5150,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
if (const BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
Address = BCI->getOperand(0);
// Parameters are handled specially.
+ bool isParameter = Variable->isParameter() || isa<Argument>(Address);
auto FINode = dyn_cast<FrameIndexSDNode>(N.getNode());
if (isParameter && FINode) {
// Byval parameter. We have a frame index at this point.
OpenPOWER on IntegriCloud