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
6 ; IPSCCP should propagate the 0 argument, eliminate the switch, and propagate
9 ; FIXME: Remove obsolete calls/instructions
11 define i32 @main() noreturn nounwind {
12 ; TUNIT: Function Attrs: mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none)
13 ; TUNIT-LABEL: define {{[^@]+}}@main
14 ; TUNIT-SAME: () #[[ATTR0:[0-9]+]] {
16 ; TUNIT-NEXT: ret i32 123
18 ; CGSCC: Function Attrs: mustprogress nofree noreturn nosync nounwind willreturn memory(none)
19 ; CGSCC-LABEL: define {{[^@]+}}@main
20 ; CGSCC-SAME: () #[[ATTR0:[0-9]+]] {
22 ; CGSCC-NEXT: [[CALL2:%.*]] = tail call noundef i32 @wwrite() #[[ATTR2:[0-9]+]]
23 ; CGSCC-NEXT: ret i32 [[CALL2]]
26 %call2 = tail call i32 @wwrite(i64 0) nounwind
30 define internal i32 @wwrite(i64 %i) nounwind readnone {
31 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
32 ; CGSCC-LABEL: define {{[^@]+}}@wwrite
33 ; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {
35 ; CGSCC-NEXT: switch i64 0, label [[SW_DEFAULT:%.*]] [
36 ; CGSCC-NEXT: i64 3, label [[RETURN:%.*]]
37 ; CGSCC-NEXT: i64 10, label [[RETURN]]
40 ; CGSCC-NEXT: ret i32 123
42 ; CGSCC-NEXT: unreachable
45 switch i64 %i, label %sw.default [
57 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) }
59 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noreturn nosync nounwind willreturn memory(none) }
60 ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
61 ; CGSCC: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn }
63 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: