blob: 968718084e42870b80dd9b70ae11f3cac722e898 [file] [log] [blame]
Dan Gohman1f522d92009-11-23 16:13:39 +00001; RUN: opt < %s -S -ipsccp | FileCheck %s
2; PR5596
3
4; IPSCCP should propagate the 0 argument, eliminate the switch, and propagate
5; the result.
6
Bill Wendling90bc19c2013-02-20 07:21:42 +00007; CHECK: define i32 @main() #0 {
Dan Gohman1f522d92009-11-23 16:13:39 +00008; CHECK-NEXT: entry:
Bill Wendlinga0323742013-02-22 09:09:42 +00009; CHECK-NEXT: %call2 = tail call i32 @wwrite(i64 0) [[NUW:#[0-9]+]]
Dan Gohman1f522d92009-11-23 16:13:39 +000010; CHECK-NEXT: ret i32 123
11
12define i32 @main() noreturn nounwind {
13entry:
14 %call2 = tail call i32 @wwrite(i64 0) nounwind
15 ret i32 %call2
16}
17
18define internal i32 @wwrite(i64 %i) nounwind readnone {
19entry:
20 switch i64 %i, label %sw.default [
21 i64 3, label %return
22 i64 10, label %return
23 ]
24
25sw.default:
26 ret i32 123
27
28return:
29 ret i32 0
30}
Bill Wendling90bc19c2013-02-20 07:21:42 +000031
32; CHECK: attributes #0 = { noreturn nounwind }
33; CHECK: attributes #1 = { nounwind readnone }
Bill Wendlinga0323742013-02-22 09:09:42 +000034; CHECK: attributes [[NUW]] = { nounwind }