Skip to content

Commit 75bfdeb

Browse files
authored
[SelectionDAG] Use poison instead of undef for dbg.values (#127915)
`undef dbg.values` can be replaced with `poison dbg.values`.
1 parent da7403e commit 75bfdeb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,12 +1384,12 @@ static bool handleDanglingVariadicDebugInfo(SelectionDAG &DAG,
13841384
DebugLoc DL, unsigned Order,
13851385
SmallVectorImpl<Value *> &Values,
13861386
DIExpression *Expression) {
1387-
// For variadic dbg_values we will now insert an undef.
1387+
// For variadic dbg_values we will now insert poison.
13881388
// FIXME: We can potentially recover these!
13891389
SmallVector<SDDbgOperand, 2> Locs;
13901390
for (const Value *V : Values) {
1391-
auto *Undef = UndefValue::get(V->getType());
1392-
Locs.push_back(SDDbgOperand::fromConst(Undef));
1391+
auto *Poison = PoisonValue::get(V->getType());
1392+
Locs.push_back(SDDbgOperand::fromConst(Poison));
13931393
}
13941394
SDDbgValue *SDV = DAG.getDbgValueList(Variable, Expression, Locs, {},
13951395
/*IsIndirect=*/false, DL, Order,
@@ -1408,9 +1408,9 @@ void SelectionDAGBuilder::addDanglingDebugInfo(SmallVectorImpl<Value *> &Values,
14081408
return;
14091409
}
14101410
// TODO: Dangling debug info will eventually either be resolved or produce
1411-
// an Undef DBG_VALUE. However in the resolution case, a gap may appear
1411+
// a poison DBG_VALUE. However in the resolution case, a gap may appear
14121412
// between the original dbg.value location and its resolved DBG_VALUE,
1413-
// which we should ideally fill with an extra Undef DBG_VALUE.
1413+
// which we should ideally fill with an extra poison DBG_VALUE.
14141414
assert(Values.size() == 1);
14151415
DanglingDebugInfoMap[Values[0]].emplace_back(Var, Expr, DL, Order);
14161416
}
@@ -1488,9 +1488,9 @@ void SelectionDAGBuilder::resolveDanglingDebugInfo(const Value *V,
14881488
} else {
14891489
LLVM_DEBUG(dbgs() << "Dropping debug info for " << printDDI(V, DDI)
14901490
<< "\n");
1491-
auto Undef = UndefValue::get(V->getType());
1491+
auto Poison = PoisonValue::get(V->getType());
14921492
auto SDV =
1493-
DAG.getConstantDbgValue(Variable, Expr, Undef, DL, DbgSDNodeOrder);
1493+
DAG.getConstantDbgValue(Variable, Expr, Poison, DL, DbgSDNodeOrder);
14941494
DAG.AddDbgValue(SDV, false);
14951495
}
14961496
}
@@ -1553,11 +1553,11 @@ void SelectionDAGBuilder::salvageUnresolvedDbgValue(const Value *V,
15531553
}
15541554

15551555
// This was the final opportunity to salvage this debug information, and it
1556-
// couldn't be done. Place an undef DBG_VALUE at this location to terminate
1556+
// couldn't be done. Place a poison DBG_VALUE at this location to terminate
15571557
// any earlier variable location.
15581558
assert(OrigV && "V shouldn't be null");
1559-
auto *Undef = UndefValue::get(OrigV->getType());
1560-
auto *SDV = DAG.getConstantDbgValue(Var, Expr, Undef, DL, SDNodeOrder);
1559+
auto *Poison = PoisonValue::get(OrigV->getType());
1560+
auto *SDV = DAG.getConstantDbgValue(Var, Expr, Poison, DL, SDNodeOrder);
15611561
DAG.AddDbgValue(SDV, false);
15621562
LLVM_DEBUG(dbgs() << "Dropping debug value info for:\n "
15631563
<< printDDI(OrigV, DDI) << "\n");
@@ -6191,10 +6191,10 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
61916191
Expr, Offset, RegFragmentSizeInBits);
61926192
Offset += RegAndSize.second;
61936193
// If a valid fragment expression cannot be created, the variable's
6194-
// correct value cannot be determined and so it is set as Undef.
6194+
// correct value cannot be determined and so it is set as poison.
61956195
if (!FragmentExpr) {
61966196
SDDbgValue *SDV = DAG.getConstantDbgValue(
6197-
Variable, Expr, UndefValue::get(V->getType()), DL, SDNodeOrder);
6197+
Variable, Expr, PoisonValue::get(V->getType()), DL, SDNodeOrder);
61986198
DAG.AddDbgValue(SDV, false);
61996199
continue;
62006200
}

0 commit comments

Comments
 (0)