Skip to content

Commit a431e97

Browse files
Kristianerikdyung
authored andcommitted
[X86] Skip debug instructions in tile copy lowering (#209640)
X86LowerTileCopy iterates over instructions in reverse to track live registers, calling LiveRegUnits::stepBackward on every instruction unconditionally. Since commit 16b2ef3 added an assertion that stepBackward must not receive debug instructions, functions containing debug info hit the assertion during tile copy lowering. This patch skips debug instructions early in the loop, matching the guard pattern used in RegisterScavenging.cpp and X86FixupBWInsts.cpp. Fixes #209512 (cherry picked from commit 3e4160f)
1 parent 8cc33c0 commit a431e97

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

llvm/lib/Target/X86/X86LowerTileCopy.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ static bool lowerTileCopy(MachineFunction &MF) {
8787
LiveRegUnits UsedRegs(*TRI);
8888
UsedRegs.addLiveOuts(MBB);
8989
for (MachineInstr &MI : llvm::make_early_inc_range(reverse(MBB))) {
90+
if (MI.isDebugInstr())
91+
continue;
9092
UsedRegs.stepBackward(MI);
9193
if (!MI.isCopy())
9294
continue;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+amx-int8 -mattr=+avx512f -verify-machineinstrs -o /dev/null
2+
3+
define void @test_debug_instr(ptr %arg) #0 !dbg !4 {
4+
#dbg_declare(ptr %arg, !12, !DIExpression(), !15)
5+
%1 = call x86_amx @llvm.x86.cast.vector.to.tile.v1024i8(<1024 x i8> zeroinitializer)
6+
%2 = call x86_amx @llvm.x86.tdpbssd.internal(i16 0, i16 0, i16 0, x86_amx %1, x86_amx %1, x86_amx %1)
7+
ret void
8+
}
9+
10+
declare x86_amx @llvm.x86.cast.vector.to.tile.v1024i8(<1024 x i8>) #1
11+
declare x86_amx @llvm.x86.tdpbssd.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx) #2
12+
13+
attributes #0 = { "target-features"="+amx-int8" }
14+
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
15+
attributes #2 = { nounwind }
16+
17+
!llvm.module.flags = !{!0}
18+
!llvm.dbg.cu = !{!1}
19+
20+
!0 = !{i32 2, !"Debug Info Version", i32 3}
21+
!1 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, nameTableKind: None)
22+
!2 = !DIFile(filename: "test.c", directory: "/tmp")
23+
!3 = !{}
24+
!4 = distinct !DISubprogram(name: "test_debug_instr", linkageName: "test_debug_instr", scope: !2, file: !2, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !1, retainedNodes: !3)
25+
!9 = distinct !DISubroutineType(types: !3)
26+
!12 = distinct !DILocalVariable(name: "a", arg: 1, scope: !4, file: !2, line: 1, type: !13)
27+
!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "__tile1024i", scope: !4, file: !2, size: 16384, align: 8192, flags: DIFlagPublic, elements: !3, identifier: "__tile1024i")
28+
!15 = !DILocation(line: 1, column: 1, scope: !4)

0 commit comments

Comments
 (0)