77 lines · plain
1# RUN: llc -mtriple=aarch64 -simplify-mir -run-pass=shrink-wrap -o - %s | FileCheck %s2--- |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+028 br i1 %0, label %common.ret, label %if.else9 10 common.ret: ; preds = %if.else, %entry, %exit111 %common.ret.op = phi double [ %3, %exit1 ], [ 0.000000e+00, %entry ], [ 0.000000e+00, %if.else ]12 ret double %common.ret.op13 14 if.else: ; preds = %entry15 %1 = call double @foo()16 %2 = fcmp oeq double %1, 0.000000e+0017 br i1 %2, label %exit1, label %common.ret18 19 exit1: ; preds = %if.else20 %3 = call double @foo()21 br label %common.ret22 }23...24# Following code has a load from constant pool. Accessing constant pool25# must not be considered as a stack access and hence, shrink wrapping must26# happen.27# CHECK-LABEL:name: shrink_wrap_load_from_const_pool28# CHECK: savePoint:29# CHECK: - point: '%bb.3'30# CHECK: restorePoint:31# CHECK: - point: '%bb.5'32---33name: shrink_wrap_load_from_const_pool34tracksRegLiveness: true35constants:36 - id: 037 value: 'double 3.125500e+02'38 alignment: 839body: |40 bb.0.entry:41 successors: %bb.4(0x50000000), %bb.2(0x30000000)42 liveins: $d043 44 renamable $d1 = COPY $d045 renamable $x8 = ADRP target-flags(aarch64-page) %const.046 renamable $d2 = LDRDui killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) %const.0 :: (load (s64) from constant-pool)47 renamable $d0 = FMOVD048 nofpexcept FCMPDrr killed renamable $d1, killed renamable $d2, implicit-def $nzcv, implicit $fpcr49 Bcc 1, %bb.2, implicit killed $nzcv50 51 bb.4:52 liveins: $d053 54 bb.1.common.ret:55 liveins: $d056 57 RET_ReallyLR implicit $d058 59 bb.2.if.else:60 successors: %bb.3(0x50000000), %bb.1(0x30000000)61 62 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp63 BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $d064 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp65 renamable $d1 = COPY $d066 renamable $d0 = FMOVD067 nofpexcept FCMPDri killed renamable $d1, implicit-def $nzcv, implicit $fpcr68 Bcc 1, %bb.1, implicit killed $nzcv69 B %bb.370 71 bb.3.exit1:72 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp73 BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $d074 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp75 B %bb.176...77