[PATCH] D140906: [DebugInfo] Replace UndefValue with PoisonValue in AssignmentTrackingAnalysis
Orlando Cazalet-Hyams via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 6 05:25:30 PST 2023
Orlando updated this revision to Diff 486826.
Orlando marked 2 inline comments as done.
Orlando added a comment.
Thanks for the review!
+ Update the docs
+ Open new parent patch D141125 <https://reviews.llvm.org/D141125> that adds is/setKillAddress
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140906/new/
https://reviews.llvm.org/D140906
Files:
llvm/docs/AssignmentTracking.md
llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
Index: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
===================================================================
--- llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -1235,10 +1235,8 @@
DILocation *DL = Source->getDebugLoc();
auto Emit = [this, Source, After, DL](Value *Val, DIExpression *Expr) {
assert(Expr);
- // It's possible that getVariableLocationOp(0) is null. Occurs in
- // llvm/test/DebugInfo/Generic/2010-05-03-OriginDIE.ll Treat it as undef.
if (!Val)
- Val = UndefValue::get(Type::getInt1Ty(Source->getContext()));
+ Val = PoisonValue::get(Type::getInt1Ty(Source->getContext()));
// Find a suitable insert point.
Instruction *InsertBefore = After->getNextNode();
@@ -1285,16 +1283,13 @@
if (Kind == LocKind::Val) {
/// Get the value component, converting to Undef if it is variadic.
Value *Val =
- Source->hasArgList()
- ? UndefValue::get(Source->getVariableLocationOp(0)->getType())
- : Source->getVariableLocationOp(0);
+ Source->hasArgList() ? nullptr : Source->getVariableLocationOp(0);
Emit(Val, Source->getExpression());
return;
}
if (Kind == LocKind::None) {
- Value *Val = UndefValue::get(Source->getVariableLocationOp(0)->getType());
- Emit(Val, Source->getExpression());
+ Emit(nullptr, Source->getExpression());
return;
}
}
@@ -2107,13 +2102,11 @@
continue;
// Wrapper to get a single value (or undef) from DVI.
auto GetValue = [DVI]() -> Value * {
- // Conditions for undef: Any operand undef, zero operands or single
- // operand is nullptr. We also can't handle variadic DIExpressions yet.
- // Some of those conditions don't have a type we can pick for
- // undef. Use i32.
+ // We can't handle variadic DIExpressions yet so treat those as
+ // kill locations.
if (DVI->isKillLocation() || DVI->getValue() == nullptr ||
DVI->hasArgList())
- return UndefValue::get(Type::getInt32Ty(DVI->getContext()));
+ return PoisonValue::get(Type::getInt32Ty(DVI->getContext()));
return DVI->getValue();
};
Instruction *InsertBefore = I.getNextNode();
Index: llvm/docs/AssignmentTracking.md
===================================================================
--- llvm/docs/AssignmentTracking.md
+++ llvm/docs/AssignmentTracking.md
@@ -63,9 +63,11 @@
The first three parameters look and behave like an `llvm.dbg.value`. `ID` is a
reference to a store (see next section). `Address` is the destination address
-of the store and it is modified by `AddressExpression`. LLVM currently encodes
-variable fragment information in `DIExpression`s, so as an implementation quirk
-the `FragmentInfo` for `Variable` is contained within `ValueExpression` only.
+of the store and it is modified by `AddressExpression`. An empty/undef/poison
+address means the address component has been killed (the memory address is no
+longer a valid location). LLVM currently encodes variable fragment information
+in `DIExpression`s, so as an implementation quirk the `FragmentInfo` for
+`Variable` is contained within `ValueExpression` only.
The formal LLVM-IR signature is:
```
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140906.486826.patch
Type: text/x-patch
Size: 3297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230106/69539278/attachment.bin>
More information about the llvm-commits
mailing list