[PATCH] D117489: [SDAG] Don't move DBG_VALUE instructions after insertion point during scheduling (PR53243)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 24 01:50:59 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
nikic marked an inline comment as done.
Closed by commit rGe7c9a6cae09d: [SDAG] Don't move DBG_VALUE instructions after insertion point during… (authored by nikic).
Changed prior to commit:
https://reviews.llvm.org/D117489?vs=400546&id=402431#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117489/new/
https://reviews.llvm.org/D117489
Files:
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
llvm/test/CodeGen/X86/pr53243-tail-call-fastisel.ll
Index: llvm/test/CodeGen/X86/pr53243-tail-call-fastisel.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/pr53243-tail-call-fastisel.ll
@@ -0,0 +1,39 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -O0 -fast-isel -mtriple=x86_64-- < %s | FileCheck %s
+
+define void @test() {
+; CHECK-LABEL: test:
+; CHECK: # %bb.0:
+; CHECK-NEXT: jmp set_state at PLT # TAILCALL
+ tail call void @set_state()
+ call void @llvm.dbg.value(metadata i64 0, metadata !10, metadata !DIExpression()), !dbg !16
+ ret void
+}
+
+declare void @set_state()
+
+; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
+declare void @llvm.dbg.value(metadata, metadata, metadata) #0
+
+attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }
+
+!llvm.module.flags = !{!0}
+!llvm.dbg.cu = !{!1}
+
+!0 = !{i32 2, !"Debug Info Version", i32 3}
+!1 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !2, producer: "clang LLVM (rustc version 1.60.0-nightly (ec4bcaac4 2022-01-15))", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3)
+!2 = !DIFile(filename: "src/lib.rs/@/bug.63e521cd-cgu.0", directory: "/tmp/rust-bug")
+!3 = !{!4}
+!4 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Option", file: !5, baseType: !6, size: 8, align: 8, flags: DIFlagEnumClass, elements: !7)
+!5 = !DIFile(filename: "<unknown>", directory: "")
+!6 = !DIBasicType(name: "u8", size: 8, encoding: DW_ATE_unsigned)
+!7 = !{!8, !9}
+!8 = !DIEnumerator(name: "None", value: 0)
+!9 = !DIEnumerator(name: "Some", value: 1)
+!10 = !DILocalVariable(name: "msg", arg: 2, scope: !11, file: !12, line: 689, type: !6)
+!11 = distinct !DISubprogram(name: "expect<()>", linkageName: "_ZN4core6option15Option$LT$T$GT$6expect17h9a574c18f194c213E", scope: !4, file: !12, line: 689, type: !13, scopeLine: 689, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !1, templateParams: !15, retainedNodes: !15)
+!12 = !DIFile(filename: "/rustc/ec4bcaac450279b029f3480b8b8f1b82ab36a5eb/library/core/src/option.rs", directory: "", checksumkind: CSK_MD5, checksum: "4120c8557937a0772190a676ec193800")
+!13 = !DISubroutineType(types: !14)
+!14 = !{null, !4}
+!15 = !{}
+!16 = !DILocation(line: 0, scope: !11)
Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
@@ -1057,12 +1057,13 @@
"first terminator cannot be a debug value");
for (MachineInstr &MI : make_early_inc_range(
make_range(std::next(FirstTerm), InsertBB->end()))) {
+ // Only scan up to insertion point.
+ if (&MI == InsertPos)
+ break;
+
if (!MI.isDebugValue())
continue;
- if (&MI == InsertPos)
- InsertPos = std::prev(InsertPos->getIterator());
-
// The DBG_VALUE was referencing a value produced by a terminator. By
// moving the DBG_VALUE, the referenced value also needs invalidating.
MI.getOperand(0).ChangeToRegister(0, false);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117489.402431.patch
Type: text/x-patch
Size: 3249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220124/066841ad/attachment.bin>
More information about the llvm-commits
mailing list