1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals 2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -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=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM 4; RUN: 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 5; 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 6; 7; #include <threads.h> 8; thread_local int gtl = 0; 9; int gsh = 0; 10; 11; static int callee(int *thread_local_ptr, int *shared_ptr) { 12; return *thread_local_ptr + *shared_ptr; 13; } 14; 15; void broker(int *, int (*callee)(int *, int *), int *); 16; 17; void caller() { 18; broker(>l, callee, &gsh); 19; } 20; 21target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 22 23@gtl = dso_local thread_local global i32 0, align 4 24@gsh = dso_local global i32 0, align 4 25 26;. 27; CHECK: @[[GTL:[a-zA-Z0-9_$"\\.-]+]] = dso_local thread_local global i32 0, align 4 28; CHECK: @[[GSH:[a-zA-Z0-9_$"\\.-]+]] = dso_local global i32 0, align 4 29;. 30define internal i32 @callee(i32* %thread_local_ptr, i32* %shared_ptr) { 31; CHECK: Function Attrs: nofree norecurse nosync nounwind readonly willreturn 32; CHECK-LABEL: define {{[^@]+}}@callee 33; CHECK-SAME: (i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) [[THREAD_LOCAL_PTR:%.*]], i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) [[SHARED_PTR:%.*]]) #[[ATTR0:[0-9]+]] { 34; CHECK-NEXT: entry: 35; CHECK-NEXT: [[TMP:%.*]] = load i32, i32* @gtl, align 4 36; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @gsh, align 4 37; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP]], [[TMP1]] 38; CHECK-NEXT: ret i32 [[ADD]] 39; 40entry: 41 %tmp = load i32, i32* %thread_local_ptr, align 4 42 %tmp1 = load i32, i32* %shared_ptr, align 4 43 %add = add nsw i32 %tmp, %tmp1 44 ret i32 %add 45} 46 47define dso_local void @caller() { 48; IS__TUNIT____-LABEL: define {{[^@]+}}@caller() { 49; IS__TUNIT____-NEXT: entry: 50; IS__TUNIT____-NEXT: call void @broker(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) undef, i32 (i32*, i32*)* noundef nonnull @callee, i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) undef) 51; IS__TUNIT____-NEXT: ret void 52; 53; IS__CGSCC____-LABEL: define {{[^@]+}}@caller() { 54; IS__CGSCC____-NEXT: entry: 55; IS__CGSCC____-NEXT: call void @broker(i32* nofree noundef nonnull readonly align 4 dereferenceable(4) @gtl, i32 (i32*, i32*)* noundef nonnull @callee, i32* nofree noundef nonnull readonly align 4 dereferenceable(4) @gsh) 56; IS__CGSCC____-NEXT: ret void 57; 58entry: 59 call void @broker(i32* nonnull @gtl, i32 (i32*, i32*)* nonnull @callee, i32* nonnull @gsh) 60 ret void 61} 62 63declare !callback !0 dso_local void @broker(i32*, i32 (i32*, i32*)*, i32*) 64 65!1 = !{i64 1, i64 0, i64 2, i1 false} 66!0 = !{!1} 67;. 68; CHECK: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readonly willreturn } 69;. 70; CHECK: [[META0:![0-9]+]] = !{!1} 71; CHECK: [[META1:![0-9]+]] = !{i64 1, i64 0, i64 2, i1 false} 72;. 73