1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -O0 -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=GFX10
6 define void @value_finder_bug() { ret void }
7 define void @value_finder_bug_before_artifact_combine() { ret void }
9 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "llvm", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
10 !1 = !DIFile(filename: "bug-legalization-artifact-combiner-dead-def", directory: "/tmp")
12 !3 = !{i32 2, !"Dwarf Version", i32 4}
13 !4 = !{i32 2, !"Debug Info Version", i32 3}
14 !5 = distinct !DISubprogram(name: "value_finder_bug_before_artifact_combine_dbg_use", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
15 !6 = !DISubroutineType(types: !2)
16 !7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8)
17 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
18 !9 = !DILocation(line: 1, column: 1, scope: !5)
22 name: value_finder_bug
25 liveins: $vgpr0, $vgpr1, $vgpr2
27 ; GFX10-LABEL: name: value_finder_bug
28 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
30 ; GFX10-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
31 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
32 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
33 ; GFX10-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
34 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:_(<4 x s32>) = G_LOAD [[MV]](p4) :: (load (<4 x s32>), align 4, addrspace 4)
35 ; GFX10-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32), [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[LOAD]](<4 x s32>)
36 ; GFX10-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY [[UV3]](s32)
37 ; GFX10-NEXT: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32), [[UV6:%[0-9]+]]:_(s32), [[UV7:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[LOAD]](<4 x s32>)
38 ; GFX10-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY [[UV6]](s32)
39 ; GFX10-NEXT: G_STORE [[COPY4]](s32), [[COPY]](p5) :: (store (s32), align 8, addrspace 5)
40 ; GFX10-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
41 ; GFX10-NEXT: [[PTR_ADD:%[0-9]+]]:_(p5) = G_PTR_ADD [[COPY]], [[C]](s32)
42 ; GFX10-NEXT: G_STORE [[COPY3]](s32), [[PTR_ADD]](p5) :: (store (s32) into unknown-address + 4, addrspace 5)
43 %0:_(p5) = COPY $vgpr0
44 %1:_(s32) = COPY $vgpr1
45 %2:_(s32) = COPY $vgpr2
46 %3:_(p4) = G_MERGE_VALUES %1(s32), %2(s32)
47 %4:_(<4 x s32>) = G_IMPLICIT_DEF
48 %5:_(<4 x s32>) = G_LOAD %3(p4) :: (load (<4 x s32>), align 4, addrspace 4)
49 %6:_(s32) = G_CONSTANT i32 3
50 %7:_(s32) = G_EXTRACT_VECTOR_ELT %5(<4 x s32>), %6(s32)
51 %8:_(<2 x s32>) = G_SHUFFLE_VECTOR %5(<4 x s32>), %4, shufflemask(2, undef)
52 %9:_(s32) = G_CONSTANT i32 1
53 %10:_(<2 x s32>) = G_INSERT_VECTOR_ELT %8, %7(s32), %9(s32)
54 G_STORE %10(<2 x s32>), %0(p5) :: (store (<2 x s32>), addrspace 5)
58 name: value_finder_bug_before_artifact_combine
61 liveins: $vgpr0, $vgpr1, $vgpr2
63 ; GFX10-LABEL: name: value_finder_bug_before_artifact_combine
64 ; GFX10: liveins: $vgpr0, $vgpr1, $vgpr2
66 ; GFX10-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
67 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
68 ; GFX10-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
69 ; GFX10-NEXT: [[MV:%[0-9]+]]:_(p4) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
70 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:_(<4 x s32>) = G_LOAD [[MV]](p4) :: (load (<4 x s32>), align 4, addrspace 4)
71 ; GFX10-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32), [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[LOAD]](<4 x s32>)
72 ; GFX10-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY [[UV3]](s32)
73 ; GFX10-NEXT: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32), [[UV6:%[0-9]+]]:_(s32), [[UV7:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[LOAD]](<4 x s32>)
74 ; GFX10-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY [[UV6]](s32)
75 ; GFX10-NEXT: G_STORE [[COPY4]](s32), [[COPY]](p5) :: (store (s32), align 8, addrspace 5)
76 ; GFX10-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
77 ; GFX10-NEXT: [[PTR_ADD:%[0-9]+]]:_(p5) = G_PTR_ADD [[COPY]], [[C]](s32)
78 ; GFX10-NEXT: G_STORE [[COPY3]](s32), [[PTR_ADD]](p5) :: (store (s32) into unknown-address + 4, addrspace 5)
79 %0:_(p5) = COPY $vgpr0
80 %1:_(s32) = COPY $vgpr1
81 %2:_(s32) = COPY $vgpr2
82 %3:_(p4) = G_MERGE_VALUES %1(s32), %2(s32)
83 %4:_(<4 x s32>) = G_LOAD %3(p4) :: (load (<4 x s32>), align 4, addrspace 4)
84 %5:_(s32) = G_EXTRACT %4(<4 x s32>), 96
85 %6:_(s32) = G_EXTRACT %4(<4 x s32>), 64
86 %7:_(s32) = G_IMPLICIT_DEF
87 %8:_(<2 x s32>) = G_BUILD_VECTOR %6(s32), %7(s32)
88 %9:_(<2 x s32>) = G_INSERT %8, %5(s32), 32
89 %deaf_def:_(s32), %11:_(s32) = G_UNMERGE_VALUES %9(<2 x s32>)
90 G_STORE %6(s32), %0(p5) :: (store (s32), align 8, addrspace 5)
91 %12:_(s32) = G_CONSTANT i32 4
92 %13:_(p5) = G_PTR_ADD %0, %12(s32)
93 G_STORE %11(s32), %13(p5) :: (store (s32) into unknown-address + 4, addrspace 5)