1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -debugify-and-strip-all-safe -run-pass machine-sink %s -o - 2>&1 | FileCheck %s
5 define void @sink_addi_fi(i32 %0) !dbg !5 {
7 %1 = alloca i32, align 4
8 call void @llvm.dbg.value(metadata ptr %1, metadata !1, metadata !DIExpression()), !dbg !3
10 br i1 %2, label %bb.2, label %bb.1
12 store volatile i32 0, ptr %1, align 4
18 declare void @llvm.dbg.value(metadata, metadata, metadata)
22 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !4)
23 !1 = !DILocalVariable(name: "var", scope: !5, file: !4, line: 2, type: !2)
24 !2 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
25 !3 = !DILocation(line: 0, scope: !5)
26 !4 = !DIFile(filename: "test.c", directory: "")
27 !5 = distinct !DISubprogram(name: "sink_addi_fi", scope: !4, file: !4, line: 1, type: !6, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !8)
28 !6 = !DISubroutineType(types: !7)
36 - { reg: '$x10', virtual-reg: '%0' }
38 - { id: 0, offset: 0, size: 4, alignment: 4 }
40 ; CHECK-LABEL: name: sink_addi_fi
42 ; CHECK-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000)
43 ; CHECK-NEXT: liveins: $x10
45 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
46 ; CHECK-NEXT: BEQ killed [[COPY]], $x0, %bb.2
49 ; CHECK-NEXT: successors: %bb.2(0x80000000)
51 ; CHECK-NEXT: [[ADDI:%[0-9]+]]:gpr = ADDI %stack.0, 0
52 ; CHECK-NEXT: SW $x0, killed [[ADDI]], 0 :: (volatile store (s32) into %stack.0)
55 ; CHECK-NEXT: PseudoRET
59 DBG_VALUE %stack.0, $noreg, !1, !DIExpression(), debug-location !3
60 %1:gpr = ADDI %stack.0, 0
61 DBG_VALUE %1, $noreg, !1, !DIExpression(DW_OP_plus_uconst, 0, DW_OP_stack_value), debug-location !3
62 BEQ killed %0:gpr, $x0, %bb.2
64 SW $x0, killed %1:gpr, 0 :: (volatile store (s32) into %stack.0, align 4)