Skip to content

Commit 2a9067b

Browse files
Evandro Menezesmemfrob
authored andcommitted
[RISCV] Improve shrink wrap test (NFC)
Restore test for shrink wrapping disabled.
1 parent b06f37c commit 2a9067b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

llvm/test/CodeGen/RISCV/shrinkwrap.ll

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple riscv32 -enable-shrink-wrap=false < %s \
3+
; RUN: | FileCheck %s -check-prefix=RV32I-SW-NO
24
; RUN: llc -mtriple riscv32 < %s \
35
; RUN: | FileCheck %s -check-prefix=RV32I-SW
46
; RUN: llc -mtriple riscv32 -mattr=+save-restore < %s \
@@ -9,6 +11,19 @@
911
declare void @abort()
1012

1113
define void @eliminate_restore(i32 %n) nounwind {
14+
; RV32I-SW-NO-LABEL: eliminate_restore:
15+
; RV32I-SW-NO: # %bb.0:
16+
; RV32I-SW-NO-NEXT: addi sp, sp, -16
17+
; RV32I-SW-NO-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
18+
; RV32I-SW-NO-NEXT: addi a1, zero, 32
19+
; RV32I-SW-NO-NEXT: bgeu a1, a0, .LBB0_2
20+
; RV32I-SW-NO-NEXT: # %bb.1: # %if.end
21+
; RV32I-SW-NO-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
22+
; RV32I-SW-NO-NEXT: addi sp, sp, 16
23+
; RV32I-SW-NO-NEXT: ret
24+
; RV32I-SW-NO-NEXT: .LBB0_2: # %if.then
25+
; RV32I-SW-NO-NEXT: call abort@plt
26+
;
1227
; RV32I-SW-LABEL: eliminate_restore:
1328
; RV32I-SW: # %bb.0:
1429
; RV32I-SW-NEXT: addi a1, zero, 32
@@ -55,6 +70,27 @@ if.end:
5570
declare void @notdead(i8*)
5671

5772
define void @conditional_alloca(i32 %n) nounwind {
73+
; RV32I-SW-NO-LABEL: conditional_alloca:
74+
; RV32I-SW-NO: # %bb.0:
75+
; RV32I-SW-NO-NEXT: addi sp, sp, -16
76+
; RV32I-SW-NO-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
77+
; RV32I-SW-NO-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
78+
; RV32I-SW-NO-NEXT: addi s0, sp, 16
79+
; RV32I-SW-NO-NEXT: addi a1, zero, 32
80+
; RV32I-SW-NO-NEXT: bltu a1, a0, .LBB1_2
81+
; RV32I-SW-NO-NEXT: # %bb.1: # %if.then
82+
; RV32I-SW-NO-NEXT: addi a0, a0, 15
83+
; RV32I-SW-NO-NEXT: andi a0, a0, -16
84+
; RV32I-SW-NO-NEXT: sub a0, sp, a0
85+
; RV32I-SW-NO-NEXT: mv sp, a0
86+
; RV32I-SW-NO-NEXT: call notdead@plt
87+
; RV32I-SW-NO-NEXT: .LBB1_2: # %if.end
88+
; RV32I-SW-NO-NEXT: addi sp, s0, -16
89+
; RV32I-SW-NO-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
90+
; RV32I-SW-NO-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
91+
; RV32I-SW-NO-NEXT: addi sp, sp, 16
92+
; RV32I-SW-NO-NEXT: ret
93+
;
5894
; RV32I-SW-LABEL: conditional_alloca:
5995
; RV32I-SW: # %bb.0:
6096
; RV32I-SW-NEXT: addi a1, zero, 32

0 commit comments

Comments
 (0)