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
5 ; Don't promote around control flow.
6 define internal i32 @callee(i1 %C, ptr %P) {
7 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
8 ; CHECK-LABEL: define {{[^@]+}}@callee
9 ; CHECK-SAME: (i1 noundef [[C:%.*]], ptr nocapture nofree readonly [[P:%.*]]) #[[ATTR0:[0-9]+]] {
11 ; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
13 ; CHECK-NEXT: ret i32 17
15 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 4
16 ; CHECK-NEXT: ret i32 [[X]]
19 br i1 %C, label %T, label %F
29 define i32 @foo(i1 %C, ptr %P) {
30 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
31 ; TUNIT-LABEL: define {{[^@]+}}@foo
32 ; TUNIT-SAME: (i1 [[C:%.*]], ptr nocapture nofree readonly [[P:%.*]]) #[[ATTR0]] {
34 ; TUNIT-NEXT: [[X:%.*]] = call i32 @callee(i1 noundef [[C]], ptr nocapture nofree readonly [[P]]) #[[ATTR1:[0-9]+]]
35 ; TUNIT-NEXT: ret i32 [[X]]
37 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
38 ; CGSCC-LABEL: define {{[^@]+}}@foo
39 ; CGSCC-SAME: (i1 noundef [[C:%.*]], ptr nocapture nofree readonly [[P:%.*]]) #[[ATTR1:[0-9]+]] {
41 ; CGSCC-NEXT: [[X:%.*]] = call i32 @callee(i1 noundef [[C]], ptr nocapture nofree readonly [[P]]) #[[ATTR2:[0-9]+]]
42 ; CGSCC-NEXT: ret i32 [[X]]
45 %X = call i32 @callee(i1 %C, ptr %P)
50 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
51 ; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(read) }
53 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
54 ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: read) }
55 ; CGSCC: attributes #[[ATTR2]] = { nofree willreturn memory(read) }