1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -march=riscv64 -debugify-and-strip-all-safe -run-pass machine-sink %s -o - 2>&1 | FileCheck %s 3 4--- | 5 define void @sink_addi_fi(i32 %0) !dbg !5 { 6 bb.0: 7 %1 = alloca i32, align 4 8 call void @llvm.dbg.value(metadata i32* %1, metadata !1, metadata !DIExpression()), !dbg !3 9 %2 = icmp eq i32 %0, 0 10 br i1 %2, label %bb.2, label %bb.1 11 bb.1: 12 store volatile i32 0, i32* %1, align 4 13 br label %bb.2 14 bb.2: 15 ret void 16 } 17 18 declare void @llvm.dbg.value(metadata, metadata, metadata) 19 20 !llvm.dbg.cu = !{!0} 21 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) 29 !7 = !{null, !2} 30 !8 = !{} 31 32... 33--- 34name: sink_addi_fi 35liveins: 36 - { reg: '$x10', virtual-reg: '%0' } 37stack: 38 - { id: 0, offset: 0, size: 4, alignment: 4 } 39body: | 40 ; CHECK-LABEL: name: sink_addi_fi 41 ; CHECK: bb.0: 42 ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000) 43 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $x10 44 ; CHECK: BEQ killed [[COPY]], $x0, %bb.2 45 ; CHECK: bb.1: 46 ; CHECK: successors: %bb.2(0x80000000) 47 ; CHECK: [[ADDI:%[0-9]+]]:gpr = ADDI %stack.0, 0 48 ; CHECK: SW $x0, killed [[ADDI]], 0 :: (volatile store 4 into %stack.0) 49 ; CHECK: bb.2: 50 ; CHECK: PseudoRET 51 bb.0: 52 liveins: $x10 53 %0:gpr = COPY $x10 54 DBG_VALUE %stack.0, $noreg, !1, !DIExpression(), debug-location !3 55 %1:gpr = ADDI %stack.0, 0 56 DBG_VALUE %1, $noreg, !1, !DIExpression(DW_OP_plus_uconst, 0, DW_OP_stack_value), debug-location !3 57 BEQ killed %0:gpr, $x0, %bb.2 58 bb.1: 59 SW $x0, killed %1:gpr, 0 :: (volatile store 4 into %stack.0, align 4) 60 bb.2: 61 PseudoRET 62