brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.6 KiB · 274181f Raw
114 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC4 5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"6target triple = "x86_64-unknown-linux-gnu"7 8%union.u = type { x86_fp80 }9%struct.s = type { double, i16, i8, [5 x i8] }10 11@b = internal global %struct.s { double 3.14, i16 9439, i8 25, [5 x i8] undef }, align 1612 13%struct.Foo = type { i32, i64 }14@a = internal global %struct.Foo { i32 1, i64 2 }, align 815 16;.17; CHECK: @b = internal global %struct.s { double 3.140000e+00, i16 9439, i8 25, [5 x i8] undef }, align 1618; CHECK: @a = internal global %struct.Foo { i32 1, i64 2 }, align 819;.20define void @run() {21;22; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)23; TUNIT-LABEL: define {{[^@]+}}@run24; TUNIT-SAME: () #[[ATTR0:[0-9]+]] {25; TUNIT-NEXT:  entry:26; TUNIT-NEXT:    unreachable27;28; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)29; CGSCC-LABEL: define {{[^@]+}}@run30; CGSCC-SAME: () #[[ATTR0:[0-9]+]] {31; CGSCC-NEXT:  entry:32; CGSCC-NEXT:    unreachable33;34entry:35  tail call i8 @UseLongDoubleUnsafely(ptr byval(%union.u) align 16 @b)36  tail call x86_fp80 @UseLongDoubleSafely(ptr byval(%union.u) align 16 @b)37  call i64 @AccessPaddingOfStruct(ptr byval(%struct.Foo) @a)38  call i64 @CaptureAStruct(ptr byval(%struct.Foo) @a)39  ret void40}41 42define internal i8 @UseLongDoubleUnsafely(ptr byval(%union.u) align 16 %arg) {43; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)44; CGSCC-LABEL: define {{[^@]+}}@UseLongDoubleUnsafely45; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {46; CGSCC-NEXT:  entry:47; CGSCC-NEXT:    ret i8 undef48;49entry:50  %bitcast = bitcast ptr %arg to ptr51  %gep = getelementptr inbounds %struct.s, ptr %bitcast, i64 0, i32 252  %result = load i8, ptr %gep53  ret i8 %result54}55 56define internal x86_fp80 @UseLongDoubleSafely(ptr byval(%union.u) align 16 %arg) {57; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)58; CGSCC-LABEL: define {{[^@]+}}@UseLongDoubleSafely59; CGSCC-SAME: () #[[ATTR1]] {60; CGSCC-NEXT:    ret x86_fp80 undef61;62  %gep = getelementptr inbounds %union.u, ptr %arg, i64 0, i32 063  %fp80 = load x86_fp80, ptr %gep64  ret x86_fp80 %fp8065}66 67define internal i64 @AccessPaddingOfStruct(ptr byval(%struct.Foo) %a) {68; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)69; CGSCC-LABEL: define {{[^@]+}}@AccessPaddingOfStruct70; CGSCC-SAME: () #[[ATTR1]] {71; CGSCC-NEXT:    ret i64 undef72;73  %p = bitcast ptr %a to ptr74  %v = load i64, ptr %p75  ret i64 %v76}77 78define internal i64 @CaptureAStruct(ptr byval(%struct.Foo) %a) {79; CGSCC: Function Attrs: nofree norecurse noreturn nosync nounwind memory(none)80; CGSCC-LABEL: define {{[^@]+}}@CaptureAStruct81; CGSCC-SAME: (i32 [[TMP0:%.*]], i64 [[TMP1:%.*]]) #[[ATTR2:[0-9]+]] {82; CGSCC-NEXT:  entry:83; CGSCC-NEXT:    [[A_PRIV:%.*]] = alloca [[STRUCT_FOO:%.*]], align 884; CGSCC-NEXT:    store i32 [[TMP0]], ptr [[A_PRIV]], align 485; CGSCC-NEXT:    [[A_PRIV_B8:%.*]] = getelementptr i8, ptr [[A_PRIV]], i64 886; CGSCC-NEXT:    store i64 [[TMP1]], ptr [[A_PRIV_B8]], align 887; CGSCC-NEXT:    [[A_PTR:%.*]] = alloca ptr, align 888; CGSCC-NEXT:    br label [[LOOP:%.*]]89; CGSCC:       loop:90; CGSCC-NEXT:    [[PHI:%.*]] = phi ptr [ null, [[ENTRY:%.*]] ], [ [[A_PRIV]], [[LOOP]] ]91; CGSCC-NEXT:    [[TMP2:%.*]] = phi ptr [ [[A_PRIV]], [[ENTRY]] ], [ [[TMP2]], [[LOOP]] ]92; CGSCC-NEXT:    br label [[LOOP]]93;94entry:95  %a_ptr = alloca ptr96  br label %loop97 98loop:99  %phi = phi ptr [ null, %entry ], [ %gep, %loop ]100  %0   = phi ptr [ %a, %entry ],   [ %0, %loop ]101  store ptr %phi, ptr %a_ptr102  %gep = getelementptr %struct.Foo, ptr %a, i64 0103  br label %loop104}105;.106; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }107;.108; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(none) }109; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }110; CGSCC: attributes #[[ATTR2]] = { nofree norecurse noreturn nosync nounwind memory(none) }111;.112;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:113; CHECK: {{.*}}114