57 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 5; Don't promote around control flow.6define internal i32 @callee(i1 %C, ptr %P) {7; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)8; CHECK-LABEL: define {{[^@]+}}@callee9; CHECK-SAME: (i1 noundef [[C:%.*]], ptr nofree readonly captures(none) [[P:%.*]]) #[[ATTR0:[0-9]+]] {10; CHECK-NEXT: entry:11; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]12; CHECK: T:13; CHECK-NEXT: ret i32 1714; CHECK: F:15; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 416; CHECK-NEXT: ret i32 [[X]]17;18entry:19 br i1 %C, label %T, label %F20 21T:22 ret i32 1723 24F:25 %X = load i32, ptr %P26 ret i32 %X27}28 29define i32 @foo(i1 %C, ptr %P) {30; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)31; TUNIT-LABEL: define {{[^@]+}}@foo32; TUNIT-SAME: (i1 [[C:%.*]], ptr nofree readonly captures(none) [[P:%.*]]) #[[ATTR0]] {33; TUNIT-NEXT: entry:34; TUNIT-NEXT: [[X:%.*]] = call i32 @callee(i1 noundef [[C]], ptr nofree readonly captures(none) [[P]]) #[[ATTR1:[0-9]+]]35; TUNIT-NEXT: ret i32 [[X]]36;37; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)38; CGSCC-LABEL: define {{[^@]+}}@foo39; CGSCC-SAME: (i1 noundef [[C:%.*]], ptr nofree readonly captures(none) [[P:%.*]]) #[[ATTR1:[0-9]+]] {40; CGSCC-NEXT: entry:41; CGSCC-NEXT: [[X:%.*]] = call i32 @callee(i1 noundef [[C]], ptr nofree readonly captures(none) [[P]]) #[[ATTR2:[0-9]+]]42; CGSCC-NEXT: ret i32 [[X]]43;44entry:45 %X = call i32 @callee(i1 %C, ptr %P)46 ret i32 %X47}48 49;.50; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }51; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(read) }52;.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) }56;.57