xref: /llvm-project/llvm/test/Transforms/SCCP/switch-multiple-undef.ll (revision 8ebb3eac02a926ffa4298c12834c57aefb2e8579)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -passes=ipsccp < %s | FileCheck %s
3
4declare void @foo()
5declare void @goo()
6declare void @patatino()
7
8define void @test1(i32 %t) {
9; CHECK-LABEL: @test1(
10; CHECK-NEXT:    [[CHOICE:%.*]] = icmp eq i32 undef, -1
11; CHECK-NEXT:    switch i1 [[CHOICE]], label [[FIRST:%.*]] [
12; CHECK-NEXT:    i1 false, label [[SECOND:%.*]]
13; CHECK-NEXT:    i1 true, label [[THIRD:%.*]]
14; CHECK-NEXT:    ]
15; CHECK:       first:
16; CHECK-NEXT:    call void @foo()
17; CHECK-NEXT:    ret void
18; CHECK:       second:
19; CHECK-NEXT:    call void @goo()
20; CHECK-NEXT:    ret void
21; CHECK:       third:
22; CHECK-NEXT:    call void @patatino()
23; CHECK-NEXT:    ret void
24;
25  %choice = icmp eq i32 undef, -1
26  switch i1 %choice, label %first [i1 0, label %second
27  i1 1, label %third]
28first:
29  call void @foo()
30  ret void
31second:
32  call void @goo()
33  ret void
34third:
35  call void @patatino()
36  ret void
37}
38