blob: ecd516519abb2ced9a8ce16d1b913e580a32c0b6 [file] [log] [blame]
Sanjay Patelecdd13d2016-05-15 18:05:10 +00001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
Benjamin Kramerd96205c2011-05-14 15:57:25 +00002; RUN: opt -S -simplifycfg < %s | FileCheck %s
3
4define i32 @test1(i32 %x) nounwind {
Sanjay Patelecdd13d2016-05-15 18:05:10 +00005; CHECK-LABEL: @test1(
6; CHECK-NEXT: a:
7; CHECK-NEXT: [[I:%.*]] = shl i32 %x, 1
8; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[I]], 24
9; CHECK-NEXT: [[DOT:%.*]] = select i1 [[COND]], i32 5, i32 0
10; CHECK-NEXT: ret i32 [[DOT]]
11;
Benjamin Kramerd96205c2011-05-14 15:57:25 +000012 %i = shl i32 %x, 1
13 switch i32 %i, label %a [
Sanjay Patelecdd13d2016-05-15 18:05:10 +000014 i32 21, label %b
15 i32 24, label %c
Benjamin Kramerd96205c2011-05-14 15:57:25 +000016 ]
17
18a:
19 ret i32 0
20b:
21 ret i32 3
22c:
23 ret i32 5
Benjamin Kramerd96205c2011-05-14 15:57:25 +000024}
25
26
27define i32 @test2(i32 %x) nounwind {
Sanjay Patelecdd13d2016-05-15 18:05:10 +000028; CHECK-LABEL: @test2(
29; CHECK-NEXT: a:
30; CHECK-NEXT: ret i32 0
31;
Benjamin Kramerd96205c2011-05-14 15:57:25 +000032 %i = shl i32 %x, 1
33 switch i32 %i, label %a [
Sanjay Patelecdd13d2016-05-15 18:05:10 +000034 i32 21, label %b
35 i32 23, label %c
Benjamin Kramerd96205c2011-05-14 15:57:25 +000036 ]
37
38a:
39 ret i32 0
40b:
41 ret i32 3
42c:
43 ret i32 5
Benjamin Kramerd96205c2011-05-14 15:57:25 +000044}