1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
4 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
6 define internal i32 @test(ptr %X, ptr %Y) {
7 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
8 ; CGSCC-LABEL: define {{[^@]+}}@test
9 ; CGSCC-SAME: (i32 [[TMP0:%.*]], ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
10 ; CGSCC-NEXT: [[X_PRIV:%.*]] = alloca i32, align 4
11 ; CGSCC-NEXT: store i32 [[TMP0]], ptr [[X_PRIV]], align 4
12 ; CGSCC-NEXT: [[A:%.*]] = load i32, ptr [[X_PRIV]], align 4
13 ; CGSCC-NEXT: [[B:%.*]] = load i32, ptr [[Y]], align 4
14 ; CGSCC-NEXT: [[C:%.*]] = add i32 [[A]], [[B]]
15 ; CGSCC-NEXT: ret i32 [[C]]
23 define internal i32 @caller(ptr %B) {
24 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
25 ; CGSCC-LABEL: define {{[^@]+}}@caller
26 ; CGSCC-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1:[0-9]+]] {
27 ; CGSCC-NEXT: [[B_PRIV:%.*]] = alloca i32, align 4
28 ; CGSCC-NEXT: store i32 [[TMP0]], ptr [[B_PRIV]], align 4
29 ; CGSCC-NEXT: [[C:%.*]] = call i32 @test(i32 noundef 1, ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B_PRIV]]) #[[ATTR2:[0-9]+]]
30 ; CGSCC-NEXT: ret i32 [[C]]
34 %C = call i32 @test(ptr %A, ptr %B)
38 define i32 @callercaller() {
39 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
40 ; TUNIT-LABEL: define {{[^@]+}}@callercaller
41 ; TUNIT-SAME: () #[[ATTR0:[0-9]+]] {
42 ; TUNIT-NEXT: [[B:%.*]] = alloca i32, align 4
43 ; TUNIT-NEXT: ret i32 3
45 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
46 ; CGSCC-LABEL: define {{[^@]+}}@callercaller
47 ; CGSCC-SAME: () #[[ATTR1]] {
48 ; CGSCC-NEXT: [[X:%.*]] = call i32 @caller(i32 noundef 2) #[[ATTR3:[0-9]+]]
49 ; CGSCC-NEXT: ret i32 [[X]]
53 %X = call i32 @caller(ptr %B)
58 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
60 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
61 ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
62 ; CGSCC: attributes #[[ATTR2]] = { nofree willreturn memory(read) }
63 ; CGSCC: attributes #[[ATTR3]] = { nofree nosync willreturn }
65 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: