199 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --include-generated-funcs --version 22; RUN: llc -mtriple=riscv64 -riscv-enable-copy-propagation -enable-machine-outliner -verify-machineinstrs < %s \3; RUN: | FileCheck %s -check-prefix=RV64I4 5; The outlined function produced by this test case contains a register to6; register copy, which is at risk of being removed by MachineCopyPropagation7; if it can't see that the copy is used. At the time of writing this test8; case, MCP will remove the copy if it is run after the machine outliner.9 10define signext i32 @nge(i32 signext %a, i32 signext %b) nounwind {11entry:12 %cmp = icmp sge i32 %a, %b13 %conv.neg = sext i1 %cmp to i3214 ret i32 %conv.neg15}16 17define signext i32 @ngt(i32 signext %a, i32 signext %b) nounwind {18entry:19 %cmp = icmp sgt i32 %a, %b20 %conv.neg = sext i1 %cmp to i3221 ret i32 %conv.neg22}23 24define signext i32 @nle(i32 signext %a, i32 signext %b) nounwind {25entry:26 %cmp = icmp sle i32 %a, %b27 %conv.neg = sext i1 %cmp to i3228 ret i32 %conv.neg29}30 31define signext i32 @nlt(i32 signext %a, i32 signext %b) nounwind {32entry:33 %cmp = icmp slt i32 %a, %b34 %conv.neg = sext i1 %cmp to i3235 ret i32 %conv.neg36}37 38define signext i32 @main() nounwind {39entry:40 %call = tail call signext i32 @nge(i32 signext -2147483648, i32 signext 2147483647)41 %cmp.not = icmp eq i32 %call, 042 br i1 %cmp.not, label %if.end, label %if.then43 44if.then:45 tail call void @abort()46 unreachable47 48if.end:49 %call1 = tail call signext i32 @nge(i32 signext 2147483647, i32 signext -2147483648)50 %cmp2.not = icmp eq i32 %call1, -151 br i1 %cmp2.not, label %if.end4, label %if.then352 53if.then3:54 tail call void @abort()55 unreachable56 57if.end4:58 %call5 = tail call signext i32 @ngt(i32 signext -2147483648, i32 signext 2147483647)59 %cmp6.not = icmp eq i32 %call5, 060 br i1 %cmp6.not, label %if.end8, label %if.then761 62if.then7:63 tail call void @abort()64 unreachable65 66if.end8:67 %call9 = tail call signext i32 @ngt(i32 signext 2147483647, i32 signext -2147483648)68 %cmp10.not = icmp eq i32 %call9, -169 br i1 %cmp10.not, label %if.end12, label %if.then1170 71if.then11:72 tail call void @abort()73 unreachable74 75if.end12:76 %call13 = tail call signext i32 @nle(i32 signext -2147483648, i32 signext 2147483647)77 %cmp14.not = icmp eq i32 %call13, -178 br i1 %cmp14.not, label %if.end16, label %if.then1579 80if.then15:81 tail call void @abort()82 unreachable83 84if.end16:85 %call17 = tail call signext i32 @nle(i32 signext 2147483647, i32 signext -2147483648)86 %cmp18.not = icmp eq i32 %call17, 087 br i1 %cmp18.not, label %if.end20, label %if.then1988 89if.then19:90 tail call void @abort()91 unreachable92 93if.end20:94 %call21 = tail call signext i32 @nlt(i32 signext -2147483648, i32 signext 2147483647)95 %cmp22.not = icmp eq i32 %call21, -196 br i1 %cmp22.not, label %if.end24, label %if.then2397 98if.then23:99 tail call void @abort()100 unreachable101 102if.end24:103 %call25 = tail call signext i32 @nlt(i32 signext 2147483647, i32 signext -2147483648)104 %cmp26.not = icmp eq i32 %call25, 0105 br i1 %cmp26.not, label %if.end28, label %if.then27106 107if.then27:108 tail call void @abort()109 unreachable110 111if.end28:112 tail call void @exit(i32 signext 0)113 unreachable114}115 116declare void @abort() noreturn117declare void @exit(i32 signext) noreturn118 119; RV64I-LABEL: nge:120; RV64I: # %bb.0: # %entry121; RV64I-NEXT: slt a0, a0, a1122; RV64I-NEXT: addi a0, a0, -1123; RV64I-NEXT: ret124;125; RV64I-LABEL: ngt:126; RV64I: # %bb.0: # %entry127; RV64I-NEXT: slt a0, a1, a0128; RV64I-NEXT: neg a0, a0129; RV64I-NEXT: ret130;131; RV64I-LABEL: nle:132; RV64I: # %bb.0: # %entry133; RV64I-NEXT: slt a0, a1, a0134; RV64I-NEXT: addi a0, a0, -1135; RV64I-NEXT: ret136;137; RV64I-LABEL: nlt:138; RV64I: # %bb.0: # %entry139; RV64I-NEXT: slt a0, a0, a1140; RV64I-NEXT: neg a0, a0141; RV64I-NEXT: ret142;143; RV64I-LABEL: main:144; RV64I: # %bb.0: # %entry145; RV64I-NEXT: addi sp, sp, -32146; RV64I-NEXT: sd ra, 24(sp) # 8-byte Folded Spill147; RV64I-NEXT: sd s0, 16(sp) # 8-byte Folded Spill148; RV64I-NEXT: sd s1, 8(sp) # 8-byte Folded Spill149; RV64I-NEXT: call t0, OUTLINED_FUNCTION_0150; RV64I-NEXT: call nge151; RV64I-NEXT: bnez a0, .LBB4_9152; RV64I-NEXT: # %bb.1: # %if.end153; RV64I-NEXT: lui a1, 524288154; RV64I-NEXT: mv a0, s0155; RV64I-NEXT: call nge156; RV64I-NEXT: li a1, -1157; RV64I-NEXT: bne a0, a1, .LBB4_9158; RV64I-NEXT: # %bb.2: # %if.end4159; RV64I-NEXT: call t0, OUTLINED_FUNCTION_0160; RV64I-NEXT: call ngt161; RV64I-NEXT: bnez a0, .LBB4_9162; RV64I-NEXT: # %bb.3: # %if.end8163; RV64I-NEXT: lui a1, 524288164; RV64I-NEXT: mv a0, s0165; RV64I-NEXT: call ngt166; RV64I-NEXT: li s1, -1167; RV64I-NEXT: bne a0, s1, .LBB4_9168; RV64I-NEXT: # %bb.4: # %if.end12169; RV64I-NEXT: call t0, OUTLINED_FUNCTION_0170; RV64I-NEXT: call nle171; RV64I-NEXT: bne a0, s1, .LBB4_9172; RV64I-NEXT: # %bb.5: # %if.end16173; RV64I-NEXT: lui a1, 524288174; RV64I-NEXT: mv a0, s0175; RV64I-NEXT: call nle176; RV64I-NEXT: bnez a0, .LBB4_9177; RV64I-NEXT: # %bb.6: # %if.end20178; RV64I-NEXT: call t0, OUTLINED_FUNCTION_0179; RV64I-NEXT: call nlt180; RV64I-NEXT: li a1, -1181; RV64I-NEXT: bne a0, a1, .LBB4_9182; RV64I-NEXT: # %bb.7: # %if.end24183; RV64I-NEXT: lui a1, 524288184; RV64I-NEXT: mv a0, s0185; RV64I-NEXT: call nlt186; RV64I-NEXT: bnez a0, .LBB4_9187; RV64I-NEXT: # %bb.8: # %if.end28188; RV64I-NEXT: call exit189; RV64I-NEXT: .LBB4_9: # %if.then190; RV64I-NEXT: call abort191;192; RV64I-LABEL: OUTLINED_FUNCTION_0:193; RV64I: # %bb.0:194; RV64I-NEXT: lui s0, 524288195; RV64I-NEXT: addiw s0, s0, -1196; RV64I-NEXT: lui a0, 524288197; RV64I-NEXT: mv a1, s0198; RV64I-NEXT: jr t0199