[PATCH] D145914: [Assignment Tracking] Do not convert variadic locations to kill locations
Orlando Cazalet-Hyams via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 13 02:39:30 PDT 2023
Orlando created this revision.
Orlando added reviewers: jmorse, StephenTozer, jryans, scott.linder.
Orlando added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Orlando requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
https://reviews.llvm.org/D145914
Files:
llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll
Index: llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll
===================================================================
--- llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll
+++ llvm/test/DebugInfo/X86/debug_value_list_selectiondag.ll
@@ -2,6 +2,11 @@
; RUN: llc %s -fast-isel=true -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,FAST %s
; RUN: llc %s -global-isel=true -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck --check-prefixes=CHECK,GLOBAL %s
+;; Run with assignment tracking enabled (use sed to add the module flag).
+; RUN: sed 's/;Uncomment-with-sed//g' < %s \
+; RUN: | llc -global-isel=false -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - \
+; RUN: | FileCheck --check-prefixes=CHECK,DAG %s
+
;; Test that a dbg.value that uses a DIArgList is correctly converted to a
;; DBG_VALUE_LIST that uses the registers corresponding to its operands.
@@ -34,7 +39,9 @@
declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5, !6}
+!llvm.module.flags = !{!3, !4, !5,
+;Uncomment-with-sed !19,
+!6}
!llvm.ident = !{!7}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
@@ -56,3 +63,4 @@
!16 = !DILocalVariable(name: "c", scope: !8, file: !9, line: 2, type: !12)
!17 = !DILocation(line: 0, scope: !8)
!18 = !DILocation(line: 3, scope: !8)
+!19 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
Index: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
===================================================================
--- llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -1297,10 +1297,7 @@
}
if (Kind == LocKind::Val) {
- /// Get the value component, converting to Undef if it is variadic.
- Value *Val =
- Source->hasArgList() ? nullptr : Source->getVariableLocationOp(0);
- Emit(ValueAsMetadata::get(Val), Source->getExpression());
+ Emit(Source->getRawLocation(), Source->getExpression());
return;
}
@@ -2126,23 +2123,11 @@
// already.
if (VarsWithStackSlot->contains(getAggregate(DVI)))
continue;
- // Wrapper to get a single value (or undef) from DVI.
- auto GetValue = [DVI]() -> RawLocationWrapper {
- // We can't handle variadic DIExpressions yet so treat those as
- // kill locations.
- Value *V;
- if (DVI->isKillLocation() || DVI->getValue() == nullptr ||
- DVI->hasArgList())
- V = PoisonValue::get(Type::getInt32Ty(DVI->getContext()));
- else
- V = DVI->getVariableLocationOp(0);
- return RawLocationWrapper(ValueAsMetadata::get(V));
- };
Instruction *InsertBefore = I.getNextNode();
assert(InsertBefore && "Unexpected: debug intrinsics after a terminator");
FnVarLocs->addVarLoc(InsertBefore, DebugVariable(DVI),
DVI->getExpression(), DVI->getDebugLoc(),
- GetValue());
+ DVI->getWrappedLocation());
InsertedAnyIntrinsics = true;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145914.504563.patch
Type: text/x-patch
Size: 3437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230313/ee9e6217/attachment.bin>
More information about the llvm-commits
mailing list