Skip to content

Commit b440b4a

Browse files
committed
[ShrinkWrap][NFC] Test with load from constant pool preventing shrink
wrapping A future patch intends improve the situation to allow shrink wrapping happen.
1 parent efcda54 commit b440b4a

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# RUN: llc -simplify-mir -run-pass=shrink-wrap -o - %s | FileCheck %s
2+
--- |
3+
declare double @foo()
4+
5+
define double @shrink_wrap_load_from_const_pool(double %q) {
6+
entry:
7+
%0 = fcmp oeq double %q, 3.125500e+02
8+
br i1 %0, label %common.ret, label %if.else
9+
10+
common.ret: ; preds = %if.else, %entry, %exit1
11+
%common.ret.op = phi double [ %3, %exit1 ], [ 0.000000e+00, %entry ], [ 0.000000e+00, %if.else ]
12+
ret double %common.ret.op
13+
14+
if.else: ; preds = %entry
15+
%1 = call double @foo()
16+
%2 = fcmp oeq double %1, 0.000000e+00
17+
br i1 %2, label %exit1, label %common.ret
18+
19+
exit1: ; preds = %if.else
20+
%3 = call double @foo()
21+
br label %common.ret
22+
}
23+
...
24+
# FIXME: Following code has a load from constant pool. Accessing constant pool
25+
# must not be considered as a stack access and hence, shrink wrapping must
26+
# happen.
27+
# CHECK-NOT: savePoint
28+
# CHECK-NOT: restorePoint
29+
---
30+
name: shrink_wrap_load_from_const_pool
31+
tracksRegLiveness: true
32+
constants:
33+
- id: 0
34+
value: 'double 3.125500e+02'
35+
alignment: 8
36+
body: |
37+
bb.0.entry:
38+
successors: %bb.4(0x50000000), %bb.2(0x30000000)
39+
liveins: $d0
40+
41+
renamable $d1 = COPY $d0
42+
renamable $x8 = ADRP target-flags(aarch64-page) %const.0
43+
renamable $d2 = LDRDui killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) %const.0 :: (load (s64) from constant-pool)
44+
renamable $d0 = FMOVD0
45+
nofpexcept FCMPDrr killed renamable $d1, killed renamable $d2, implicit-def $nzcv, implicit $fpcr
46+
Bcc 1, %bb.2, implicit killed $nzcv
47+
48+
bb.4:
49+
liveins: $d0
50+
51+
bb.1.common.ret:
52+
liveins: $d0
53+
54+
RET_ReallyLR implicit $d0
55+
56+
bb.2.if.else:
57+
successors: %bb.3(0x50000000), %bb.1(0x30000000)
58+
59+
ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
60+
BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $d0
61+
ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
62+
renamable $d1 = COPY $d0
63+
renamable $d0 = FMOVD0
64+
nofpexcept FCMPDri killed renamable $d1, implicit-def $nzcv, implicit $fpcr
65+
Bcc 1, %bb.1, implicit killed $nzcv
66+
B %bb.3
67+
68+
bb.3.exit1:
69+
ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
70+
BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $d0
71+
ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
72+
B %bb.1
73+
...

0 commit comments

Comments
 (0)