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 5 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 8# ARM64. 9# The same test gets shrink wrapped on Linux ARM64. 10 11# WIN64-LABEL: bb.0.entry: 12# WIN64: early-clobber $sp = frame-setup STRXpre killed $x19, $sp, -32 13# WIN64-LABEL: bb.1: 14# WIN64-LABEL: bb.2.if.then: 15 16# LINUX-LABEL: bb.0.entry: 17# LINUX-LABEL: bb.1: 18# LINUX-LABEL: bb.2.if.then: 19# LINUX: early-clobber $sp = frame-setup STRXpre killed $fp, $sp, -32 20--- | 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" 24 25 define dso_local i32 @"?func@@YAHHH@Z"(i32 %a, i32 %b) local_unnamed_addr #0 { 26 entry: 27 %A = alloca [1000 x i32], align 4 28 %cmp = icmp sgt i32 %a, 1 29 br i1 %cmp, label %if.then, label %return 30 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 38 %add = add i32 %b, 1 39 %add1 = add i32 %add, %1 40 call void @llvm.lifetime.end.p0i8(i64 4000, i8* nonnull %0) #3 41 br label %return 42 43 return: ; preds = %entry, %if.then 44 %retval.0 = phi i32 [ %add1, %if.then ], [ 0, %entry ] 45 ret i32 %retval.0 46 } 47 48 ; Function Attrs: argmemonly nounwind 49 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1 50 51 declare dso_local void @"?init@@YAXPEAH@Z"(i32*) local_unnamed_addr #2 52 53 ; Function Attrs: argmemonly nounwind 54 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 55 56 ; Function Attrs: nounwind 57 declare void @llvm.stackprotector(i8*, i8**) #3 58 59 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "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" "frame-pointer"="none" "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 } 63 64 !llvm.module.flags = !{!0} 65 !llvm.ident = !{!1} 66 67 !0 = !{i32 1, !"wchar_size", i32 2} 68 !1 = !{!"clang version 8.0.0"} 69 !2 = !{!3, !3, i64 0} 70 !3 = !{!"int", !4, i64 0} 71 !4 = !{!"omnipotent char", !5, i64 0} 72 !5 = !{!"Simple C++ TBAA"} 73 74... 75--- 76name: '?func@@YAHHH@Z' 77alignment: 4 78exposesReturnsTwice: false 79legalized: false 80regBankSelected: false 81selected: false 82failedISel: false 83tracksRegLiveness: true 84registers: 85liveins: 86 - { reg: '$w0', virtual-reg: '' } 87 - { reg: '$w1', virtual-reg: '' } 88frameInfo: 89 isFrameAddressTaken: false 90 isReturnAddressTaken: false 91 hasStackMap: false 92 hasPatchPoint: false 93 stackSize: 0 94 offsetAdjustment: 0 95 maxAlignment: 4 96 adjustsStack: true 97 hasCalls: true 98 stackProtector: '' 99 maxCallFrameSize: 0 100 cvBytesOfCalleeSavedRegisters: 0 101 hasOpaqueSPAdjustment: false 102 hasVAStart: false 103 hasMustTailInVarArgFunc: false 104 localFrameSize: 4000 105 savePoint: '' 106 restorePoint: '' 107fixedStack: 108stack: 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: '' } 113constants: 114body: | 115 bb.0.entry: 116 successors: %bb.2(0x40000000), %bb.1(0x40000000) 117 liveins: $w0, $w1 118 119 dead $wzr = SUBSWri killed renamable $w0, 2, 0, implicit-def $nzcv 120 Bcc 10, %bb.2, implicit killed $nzcv 121 122 bb.1: 123 successors: %bb.3(0x80000000) 124 125 renamable $w0 = COPY $wzr 126 B %bb.3 127 128 bb.2.if.then: 129 successors: %bb.3(0x80000000) 130 liveins: $w1 131 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 140 141 bb.3.return: 142 liveins: $w0 143 144 RET_ReallyLR implicit $w0 145 146... 147