1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes 2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM 3; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM 4; TODO: The old pass manager cgscc run is disabled as it causes a crash on windows which is under investigation: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/23151 5; opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM 6; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM 7 8target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 9target triple = "x86_64-unknown-linux-gnu" 10 11%union.u = type { x86_fp80 } 12%struct.s = type { double, i16, i8, [5 x i8] } 13 14@b = internal global %struct.s { double 3.14, i16 9439, i8 25, [5 x i8] undef }, align 16 15 16%struct.Foo = type { i32, i64 } 17@a = internal global %struct.Foo { i32 1, i64 2 }, align 8 18 19define void @run() { 20; NOT_CGSCC_NPM: Function Attrs: nofree noreturn nosync nounwind readnone 21; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@run 22; NOT_CGSCC_NPM-SAME: () [[ATTR0:#.*]] { 23; NOT_CGSCC_NPM-NEXT: entry: 24; NOT_CGSCC_NPM-NEXT: unreachable 25; 26; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readonly willreturn 27; IS__CGSCC____-LABEL: define {{[^@]+}}@run 28; IS__CGSCC____-SAME: () [[ATTR0:#.*]] { 29; IS__CGSCC____-NEXT: entry: 30; IS__CGSCC____-NEXT: unreachable 31; 32entry: 33 tail call i8 @UseLongDoubleUnsafely(%union.u* byval(%union.u) align 16 bitcast (%struct.s* @b to %union.u*)) 34 tail call x86_fp80 @UseLongDoubleSafely(%union.u* byval(%union.u) align 16 bitcast (%struct.s* @b to %union.u*)) 35 call i64 @AccessPaddingOfStruct(%struct.Foo* @a) 36 call i64 @CaptureAStruct(%struct.Foo* @a) 37 ret void 38} 39 40define internal i8 @UseLongDoubleUnsafely(%union.u* byval(%union.u) align 16 %arg) { 41; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 42; IS__CGSCC____-LABEL: define {{[^@]+}}@UseLongDoubleUnsafely 43; IS__CGSCC____-SAME: () [[ATTR1:#.*]] { 44; IS__CGSCC____-NEXT: entry: 45; IS__CGSCC____-NEXT: ret i8 undef 46; 47entry: 48 %bitcast = bitcast %union.u* %arg to %struct.s* 49 %gep = getelementptr inbounds %struct.s, %struct.s* %bitcast, i64 0, i32 2 50 %result = load i8, i8* %gep 51 ret i8 %result 52} 53 54define internal x86_fp80 @UseLongDoubleSafely(%union.u* byval(%union.u) align 16 %arg) { 55; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 56; IS__CGSCC____-LABEL: define {{[^@]+}}@UseLongDoubleSafely 57; IS__CGSCC____-SAME: () [[ATTR1]] { 58; IS__CGSCC____-NEXT: ret x86_fp80 undef 59; 60 %gep = getelementptr inbounds %union.u, %union.u* %arg, i64 0, i32 0 61 %fp80 = load x86_fp80, x86_fp80* %gep 62 ret x86_fp80 %fp80 63} 64 65define internal i64 @AccessPaddingOfStruct(%struct.Foo* byval(%struct.Foo) %a) { 66; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 67; IS__CGSCC____-LABEL: define {{[^@]+}}@AccessPaddingOfStruct 68; IS__CGSCC____-SAME: () [[ATTR1]] { 69; IS__CGSCC____-NEXT: ret i64 undef 70; 71 %p = bitcast %struct.Foo* %a to i64* 72 %v = load i64, i64* %p 73 ret i64 %v 74} 75 76define internal i64 @CaptureAStruct(%struct.Foo* byval(%struct.Foo) %a) { 77; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@CaptureAStruct 78; IS__CGSCC_OPM-SAME: (%struct.Foo* noalias nofree byval(%struct.Foo) [[A:%.*]]) 79; IS__CGSCC_OPM-NEXT: entry: 80; IS__CGSCC_OPM-NEXT: [[A_PTR:%.*]] = alloca %struct.Foo* 81; IS__CGSCC_OPM-NEXT: br label [[LOOP:%.*]] 82; IS__CGSCC_OPM: loop: 83; IS__CGSCC_OPM-NEXT: [[PHI:%.*]] = phi %struct.Foo* [ null, [[ENTRY:%.*]] ], [ [[GEP:%.*]], [[LOOP]] ] 84; IS__CGSCC_OPM-NEXT: [[TMP0:%.*]] = phi %struct.Foo* [ [[A]], [[ENTRY]] ], [ [[TMP0]], [[LOOP]] ] 85; IS__CGSCC_OPM-NEXT: store %struct.Foo* [[PHI]], %struct.Foo** [[A_PTR]], align 8 86; IS__CGSCC_OPM-NEXT: [[GEP]] = getelementptr [[STRUCT_FOO:%.*]], %struct.Foo* [[A]], i64 0 87; IS__CGSCC_OPM-NEXT: br label [[LOOP]] 88; 89; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone 90; IS__CGSCC____-LABEL: define {{[^@]+}}@CaptureAStruct 91; IS__CGSCC____-SAME: (i32 [[TMP0:%.*]], i64 [[TMP1:%.*]]) [[ATTR2:#.*]] { 92; IS__CGSCC____-NEXT: entry: 93; IS__CGSCC____-NEXT: [[A_PRIV:%.*]] = alloca [[STRUCT_FOO:%.*]], align 8 94; IS__CGSCC____-NEXT: [[A_PRIV_CAST:%.*]] = bitcast %struct.Foo* [[A_PRIV]] to i32* 95; IS__CGSCC____-NEXT: store i32 [[TMP0]], i32* [[A_PRIV_CAST]], align 8 96; IS__CGSCC____-NEXT: [[A_PRIV_0_1:%.*]] = getelementptr [[STRUCT_FOO]], %struct.Foo* [[A_PRIV]], i32 0, i32 1 97; IS__CGSCC____-NEXT: store i64 [[TMP1]], i64* [[A_PRIV_0_1]], align 8 98; IS__CGSCC____-NEXT: [[A_PTR:%.*]] = alloca %struct.Foo*, align 8 99; IS__CGSCC____-NEXT: br label [[LOOP:%.*]] 100; IS__CGSCC____: loop: 101; IS__CGSCC____-NEXT: [[PHI:%.*]] = phi %struct.Foo* [ null, [[ENTRY:%.*]] ], [ [[GEP:%.*]], [[LOOP]] ] 102; IS__CGSCC____-NEXT: [[TMP2:%.*]] = phi %struct.Foo* [ [[A_PRIV]], [[ENTRY]] ], [ [[TMP2]], [[LOOP]] ] 103; IS__CGSCC____-NEXT: store %struct.Foo* [[PHI]], %struct.Foo** [[A_PTR]], align 8 104; IS__CGSCC____-NEXT: [[GEP]] = getelementptr [[STRUCT_FOO]], %struct.Foo* [[A_PRIV]], i64 0 105; IS__CGSCC____-NEXT: br label [[LOOP]] 106; 107entry: 108 %a_ptr = alloca %struct.Foo* 109 br label %loop 110 111loop: 112 %phi = phi %struct.Foo* [ null, %entry ], [ %gep, %loop ] 113 %0 = phi %struct.Foo* [ %a, %entry ], [ %0, %loop ] 114 store %struct.Foo* %phi, %struct.Foo** %a_ptr 115 %gep = getelementptr %struct.Foo, %struct.Foo* %a, i64 0 116 br label %loop 117} 118