1 # RUN: llc -O2 -o - %s -mtriple=aarch64-windows -start-before=shrink-wrap \
2 # RUN: -stop-after=prologepilog | FileCheck %s --check-prefix=WIN64
3 # RUN: llc -O2 -o - %s -mtriple=aarch64-linux -start-before=shrink-wrap \
4 # RUN: -stop-after=prologepilog | FileCheck %s --check-prefix=LINUX
6 # This tests checks that shrink wrapping bails out on Windows AMR64 due to the
7 # use of Windows CFI. We don't currently support fragments for WIndows EH on
9 # The same test gets shrink wrapped on Linux ARM64.
11 # WIN64-LABEL: bb.0.entry:
12 # WIN64: early-clobber $sp = frame-setup STRXpre killed $x28, $sp, -32
14 # WIN64-LABEL: bb.2.if.then:
16 # LINUX-LABEL: bb.0.entry:
18 # LINUX-LABEL: bb.2.if.then:
19 # LINUX: early-clobber $sp = frame-setup STRXpre killed $x28, $sp, -32
21 ; ModuleID = 'shrink.cpp'
22 target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
23 target triple = "aarch64-unknown-windows-msvc19.11.0"
25 define dso_local i32 @"?func@@YAHHH@Z"(i32 %a, i32 %b) local_unnamed_addr #0 {
27 %A = alloca [1000 x i32], align 4
28 %cmp = icmp sgt i32 %a, 1
29 br i1 %cmp, label %if.then, label %return
31 if.then: ; preds = %entry
32 %0 = bitcast [1000 x i32]* %A to i8*
33 call void @llvm.lifetime.start.p0i8(i64 4000, i8* nonnull %0) #3
34 %arraydecay2 = bitcast [1000 x i32]* %A to i32*
35 call void @"?init@@YAXPEAH@Z"(i32* nonnull %arraydecay2)
36 %arrayidx = getelementptr inbounds [1000 x i32], [1000 x i32]* %A, i64 0, i64 100
37 %1 = load i32, i32* %arrayidx, align 4, !tbaa !2
39 %add1 = add i32 %add, %1
40 call void @llvm.lifetime.end.p0i8(i64 4000, i8* nonnull %0) #3
43 return: ; preds = %entry, %if.then
44 %retval.0 = phi i32 [ %add1, %if.then ], [ 0, %entry ]
48 ; Function Attrs: argmemonly nounwind
49 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
51 declare dso_local void @"?init@@YAXPEAH@Z"(i32*) local_unnamed_addr #2
53 ; Function Attrs: argmemonly nounwind
54 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
56 ; Function Attrs: nounwind
57 declare void @llvm.stackprotector(i8*, i8**) #3
59 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
60 attributes #1 = { argmemonly nounwind }
61 attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
62 attributes #3 = { nounwind }
64 !llvm.module.flags = !{!0}
67 !0 = !{i32 1, !"wchar_size", i32 2}
68 !1 = !{!"clang version 8.0.0"}
70 !3 = !{!"int", !4, i64 0}
71 !4 = !{!"omnipotent char", !5, i64 0}
72 !5 = !{!"Simple C++ TBAA"}
76 name: '?func@@YAHHH@Z'
78 exposesReturnsTwice: false
80 regBankSelected: false
83 tracksRegLiveness: true
86 - { reg: '$w0', virtual-reg: '' }
87 - { reg: '$w1', virtual-reg: '' }
89 isFrameAddressTaken: false
90 isReturnAddressTaken: false
100 cvBytesOfCalleeSavedRegisters: 0
101 hasOpaqueSPAdjustment: false
103 hasMustTailInVarArgFunc: false
109 - { id: 0, name: A, type: default, offset: 0, size: 4000, alignment: 4,
110 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
111 local-offset: -4000, debug-info-variable: '', debug-info-expression: '',
112 debug-info-location: '' }
116 successors: %bb.2(0x40000000), %bb.1(0x40000000)
119 dead $wzr = SUBSWri killed renamable $w0, 2, 0, implicit-def $nzcv
120 Bcc 10, %bb.2, implicit killed $nzcv
123 successors: %bb.3(0x80000000)
125 renamable $w0 = COPY $wzr
129 successors: %bb.3(0x80000000)
132 renamable $w19 = COPY $w1
133 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
134 $x0 = ADDXri %stack.0.A, 0, 0
135 BL @"?init@@YAXPEAH@Z", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit-def $sp
136 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
137 renamable $w8 = LDRWui %stack.0.A, 100 :: (dereferenceable load 4 from %ir.arrayidx, !tbaa !2)
138 renamable $w8 = ADDWrr killed renamable $w19, killed renamable $w8
139 renamable $w0 = ADDWri killed renamable $w8, 1, 0
144 RET_ReallyLR implicit $w0