1; REQUIRES: aarch64-registered-target 2 3; Test IPA over a single combined file 4; RUN: llvm-as %s -o %t0.bc 5; RUN: llvm-as %S/Inputs/ipa-alias.ll -o %t1.bc 6; RUN: llvm-link %t0.bc %t1.bc -o %t.combined.bc 7 8; RUN: opt -S -analyze -stack-safety-local %t.combined.bc | FileCheck %s --check-prefixes=CHECK,LOCAL 9; RUN: opt -S -passes="print<stack-safety-local>" -disable-output %t.combined.bc 2>&1 | FileCheck %s --check-prefixes=CHECK,LOCAL 10 11; RUN: opt -S -analyze -stack-safety %t.combined.bc | FileCheck %s --check-prefixes=CHECK,GLOBAL,NOLTO 12; RUN: opt -S -passes="print-stack-safety" -disable-output %t.combined.bc 2>&1 | FileCheck %s --check-prefixes=CHECK,GLOBAL,NOLTO 13 14; Do an end-to-test using the new LTO API 15; RUN: opt -module-summary %s -o %t.summ0.bc 16; RUN: opt -module-summary %S/Inputs/ipa-alias.ll -o %t.summ1.bc 17 18; RUN: llvm-lto2 run %t.summ0.bc %t.summ1.bc -o %t.lto -stack-safety-print -stack-safety-run -save-temps -thinlto-threads 1 -O0 \ 19; RUN: -r %t.summ0.bc,AliasCall,px \ 20; RUN: -r %t.summ0.bc,AliasToBitcastAliasWrite1, \ 21; RUN: -r %t.summ0.bc,AliasToPreemptableAliasWrite1, \ 22; RUN: -r %t.summ0.bc,AliasWrite1, \ 23; RUN: -r %t.summ0.bc,BitcastAliasCall,px \ 24; RUN: -r %t.summ0.bc,BitcastAliasWrite1, \ 25; RUN: -r %t.summ0.bc,InterposableAliasCall,px \ 26; RUN: -r %t.summ0.bc,InterposableAliasWrite1, \ 27; RUN: -r %t.summ0.bc,PreemptableAliasCall,px \ 28; RUN: -r %t.summ0.bc,PreemptableAliasWrite1, \ 29; RUN: -r %t.summ1.bc,AliasToBitcastAliasWrite1,px \ 30; RUN: -r %t.summ1.bc,AliasToPreemptableAliasWrite1,px \ 31; RUN: -r %t.summ1.bc,AliasWrite1,px \ 32; RUN: -r %t.summ1.bc,BitcastAliasWrite1,px \ 33; RUN: -r %t.summ1.bc,InterposableAliasWrite1,px \ 34; RUN: -r %t.summ1.bc,PreemptableAliasWrite1,px \ 35; RUN: -r %t.summ1.bc,Write1,px \ 36; RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK,GLOBAL,LTO 37 38; RUN: llvm-lto2 run %t.summ0.bc %t.summ1.bc -o %t-newpm.lto -stack-safety-print -stack-safety-run -save-temps -use-new-pm -thinlto-threads 1 -O0 \ 39; RUN: -r %t.summ0.bc,AliasCall,px \ 40; RUN: -r %t.summ0.bc,AliasToBitcastAliasWrite1, \ 41; RUN: -r %t.summ0.bc,AliasToPreemptableAliasWrite1, \ 42; RUN: -r %t.summ0.bc,AliasWrite1, \ 43; RUN: -r %t.summ0.bc,BitcastAliasCall,px \ 44; RUN: -r %t.summ0.bc,BitcastAliasWrite1, \ 45; RUN: -r %t.summ0.bc,InterposableAliasCall,px \ 46; RUN: -r %t.summ0.bc,InterposableAliasWrite1, \ 47; RUN: -r %t.summ0.bc,PreemptableAliasCall,px \ 48; RUN: -r %t.summ0.bc,PreemptableAliasWrite1, \ 49; RUN: -r %t.summ1.bc,AliasToBitcastAliasWrite1,px \ 50; RUN: -r %t.summ1.bc,AliasToPreemptableAliasWrite1,px \ 51; RUN: -r %t.summ1.bc,AliasWrite1,px \ 52; RUN: -r %t.summ1.bc,BitcastAliasWrite1,px \ 53; RUN: -r %t.summ1.bc,InterposableAliasWrite1,px \ 54; RUN: -r %t.summ1.bc,PreemptableAliasWrite1,px \ 55; RUN: -r %t.summ1.bc,Write1,px \ 56; RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK,GLOBAL,LTO 57 58target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 59target triple = "aarch64-unknown-linux" 60 61attributes #0 = { sanitize_memtag "target-features"="+mte,+neon" } 62 63declare void @PreemptableAliasWrite1(i8* %p) 64declare void @AliasToPreemptableAliasWrite1(i8* %p) 65 66declare void @InterposableAliasWrite1(i8* %p) 67; Aliases to interposable aliases are not allowed 68 69declare void @AliasWrite1(i8* %p) 70 71declare void @BitcastAliasWrite1(i32* %p) 72declare void @AliasToBitcastAliasWrite1(i8* %p) 73 74; Call to dso_preemptable alias to a dso_local aliasee 75define void @PreemptableAliasCall() #0 { 76; CHECK-LABEL: @PreemptableAliasCall dso_preemptable{{$}} 77; CHECK-NEXT: args uses: 78; CHECK-NEXT: allocas uses: 79; LOCAL-NEXT: x1[1]: empty-set, @PreemptableAliasWrite1(arg0, [0,1)){{$}} 80; GLOBAL-NEXT: x1[1]: full-set, @PreemptableAliasWrite1(arg0, [0,1)){{$}} 81; LOCAL-NEXT: x2[1]: empty-set, @AliasToPreemptableAliasWrite1(arg0, [0,1)){{$}} 82; GLOBAL-NEXT: x2[1]: [0,1), @AliasToPreemptableAliasWrite1(arg0, [0,1)){{$}} 83; CHECK-EMPTY: 84entry: 85 %x1 = alloca i8 86 call void @PreemptableAliasWrite1(i8* %x1) 87 88 %x2 = alloca i8 89; Alias to a preemptable alias is not preemptable 90 call void @AliasToPreemptableAliasWrite1(i8* %x2) 91 ret void 92} 93 94; Call to an interposable alias to a non-interposable aliasee 95define void @InterposableAliasCall() #0 { 96; CHECK-LABEL: @InterposableAliasCall dso_preemptable{{$}} 97; CHECK-NEXT: args uses: 98; CHECK-NEXT: allocas uses: 99; LOCAL-NEXT: x[1]: empty-set, @InterposableAliasWrite1(arg0, [0,1)){{$}} 100; NOLTO-NEXT: x[1]: full-set, @InterposableAliasWrite1(arg0, [0,1)){{$}} 101; LTO-NEXT: x[1]: [0,1), @InterposableAliasWrite1(arg0, [0,1)){{$}} 102; CHECK-EMPTY: 103entry: 104 %x = alloca i8 105; ThinLTO can resolve the prevailing implementation for interposable definitions. 106 call void @InterposableAliasWrite1(i8* %x) 107 ret void 108} 109 110; Call to a dso_local/non-interposable alias/aliasee 111define void @AliasCall() #0 { 112; CHECK-LABEL: @AliasCall dso_preemptable{{$}} 113; CHECK-NEXT: args uses: 114; CHECK-NEXT: allocas uses: 115; LOCAL-NEXT: x[1]: empty-set, @AliasWrite1(arg0, [0,1)){{$}} 116; GLOBAL-NEXT: x[1]: [0,1), @AliasWrite1(arg0, [0,1)){{$}} 117; CHECK-EMPTY: 118entry: 119 %x = alloca i8 120 call void @AliasWrite1(i8* %x) 121 ret void 122} 123 124; Call to a bitcasted dso_local/non-interposable alias/aliasee 125define void @BitcastAliasCall() #0 { 126; CHECK-LABEL: @BitcastAliasCall dso_preemptable{{$}} 127; CHECK-NEXT: args uses: 128; CHECK-NEXT: allocas uses: 129; LOCAL-NEXT: x1[4]: empty-set, @BitcastAliasWrite1(arg0, [0,1)){{$}} 130; GLOBAL-NEXT: x1[4]: [0,1), @BitcastAliasWrite1(arg0, [0,1)){{$}} 131; LOCAL-NEXT: x2[1]: empty-set, @AliasToBitcastAliasWrite1(arg0, [0,1)){{$}} 132; GLOBAL-NEXT: x2[1]: [0,1), @AliasToBitcastAliasWrite1(arg0, [0,1)){{$}} 133; CHECK-EMPTY: 134entry: 135 %x1 = alloca i32 136 call void @BitcastAliasWrite1(i32* %x1) 137 %x2 = alloca i8 138 call void @AliasToBitcastAliasWrite1(i8* %x2) 139 ret void 140} 141 142; The rest is from Inputs/ipa-alias.ll 143 144; CHECK-LABEL: @Write1{{$}} 145; CHECK-NEXT: args uses: 146; CHECK-NEXT: p[]: [0,1){{$}} 147; CHECK-NEXT: allocas uses: 148; CHECK-EMPTY: 149