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; PR5596 5 6; IPSCCP should propagate the 0 argument, eliminate the switch, and propagate 7; the result. 8 9; FIXME: Remove obsolete calls/instructions 10 11define 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]+]] { 15; TUNIT-NEXT: entry: 16; TUNIT-NEXT: ret i32 123 17; 18; CGSCC: Function Attrs: mustprogress nofree noreturn nosync nounwind willreturn memory(none) 19; CGSCC-LABEL: define {{[^@]+}}@main 20; CGSCC-SAME: () #[[ATTR0:[0-9]+]] { 21; CGSCC-NEXT: entry: 22; CGSCC-NEXT: [[CALL2:%.*]] = tail call noundef i32 @wwrite() #[[ATTR2:[0-9]+]] 23; CGSCC-NEXT: ret i32 [[CALL2]] 24; 25entry: 26 %call2 = tail call i32 @wwrite(i64 0) nounwind 27 ret i32 %call2 28} 29 30define 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]+]] { 34; CGSCC-NEXT: entry: 35; CGSCC-NEXT: switch i64 0, label [[SW_DEFAULT:%.*]] [ 36; CGSCC-NEXT: i64 3, label [[RETURN:%.*]] 37; CGSCC-NEXT: i64 10, label [[RETURN]] 38; CGSCC-NEXT: ] 39; CGSCC: sw.default: 40; CGSCC-NEXT: ret i32 123 41; CGSCC: return: 42; CGSCC-NEXT: unreachable 43; 44entry: 45 switch i64 %i, label %sw.default [ 46 i64 3, label %return 47 i64 10, label %return 48 ] 49 50sw.default: 51 ret i32 123 52 53return: 54 ret i32 0 55} 56;. 57; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) } 58;. 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 } 62;. 63;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: 64; CHECK: {{.*}} 65