diff options
author | OCHyams <orlando.hyams@sony.com> | 2023-01-12 09:51:08 +0000 |
---|---|---|
committer | OCHyams <orlando.hyams@sony.com> | 2023-01-12 09:51:45 +0000 |
commit | 12ece76815ab330f8f33707efd7c93735dd9c178 (patch) | |
tree | f2438e9b984ac6b18b6b75adf74877fda647fa67 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp | |
parent | 301123c7a8b5f5dd415e336ff933576279b0e868 (diff) | |
download | llvm-12ece76815ab330f8f33707efd7c93735dd9c178.zip llvm-12ece76815ab330f8f33707efd7c93735dd9c178.tar.gz llvm-12ece76815ab330f8f33707efd7c93735dd9c178.tar.bz2 |
[DebugInfo] Replace UndefValue with PoisonValue in AssignmentTrackingAnalysis
This helps towards the effort to remove UndefValue from LLVM.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D140906
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp index bf421a40..ba51c3b 100644 --- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp +++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp @@ -1239,10 +1239,8 @@ void AssignmentTrackingLowering::emitDbgValue( 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(); @@ -1289,16 +1287,13 @@ void AssignmentTrackingLowering::emitDbgValue( 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; } } @@ -2111,13 +2106,11 @@ bool AssignmentTrackingLowering::emitPromotedVarLocs( 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(); |