DAGCombine: Avoid an edge case where it tried to create an i0 type for (x & 0) == 0.
[oota-llvm.git] / test / CodeGen / X86 / shrink-compare.ll
1 ; RUN: llc < %s -march=x86-64 | FileCheck %s
2
3 declare void @bar()
4
5 define void @test1(i32* nocapture %X) nounwind {
6 entry:
7   %tmp1 = load i32* %X, align 4
8   %and = and i32 %tmp1, 255
9   %cmp = icmp eq i32 %and, 47
10   br i1 %cmp, label %if.then, label %if.end
11
12 if.then:
13   tail call void @bar() nounwind
14   br label %if.end
15
16 if.end:
17   ret void
18 ; CHECK: test1:
19 ; CHECK: cmpb $47, (%{{rdi|rcx}})
20 }
21
22 define void @test2(i32 %X) nounwind {
23 entry:
24   %and = and i32 %X, 255
25   %cmp = icmp eq i32 %and, 47
26   br i1 %cmp, label %if.then, label %if.end
27
28 if.then:
29   tail call void @bar() nounwind
30   br label %if.end
31
32 if.end:
33   ret void
34 ; CHECK: test2:
35 ; CHECK: cmpb $47, %{{dil|cl}}
36 }
37
38 define void @test3(i32 %X) nounwind {
39 entry:
40   %and = and i32 %X, 255
41   %cmp = icmp eq i32 %and, 255
42   br i1 %cmp, label %if.then, label %if.end
43
44 if.then:
45   tail call void @bar() nounwind
46   br label %if.end
47
48 if.end:
49   ret void
50 ; CHECK: test3:
51 ; CHECK: cmpb $-1, %{{dil|cl}}
52 }
53
54 ; PR16083
55 define i1 @test4(i64 %a, i32 %b) {
56 entry:
57   %tobool = icmp ne i32 %b, 0
58   br i1 %tobool, label %lor.end, label %lor.rhs
59
60 lor.rhs:                                          ; preds = %entry
61   %and = and i64 0, %a
62   %tobool1 = icmp ne i64 %and, 0
63   br label %lor.end
64
65 lor.end:                                          ; preds = %lor.rhs, %entry
66   %p = phi i1 [ true, %entry ], [ %tobool1, %lor.rhs ]
67   ret i1 %p
68 }