xref: /llvm-project/llvm/test/Transforms/InstCombine/pr27996.ll (revision 4ab40eca080965c65802710e39adbb78c4ce7bde)
1; RUN: opt < %s -passes=instcombine -S | FileCheck %s
2
3
4@i = constant i32 1, align 4
5@f = constant float 0x3FF19999A0000000, align 4
6@cmp = common global i32 0, align 4
7@resf = common global ptr null, align 8
8@resi = common global ptr null, align 8
9
10define i32 @foo() {
11entry:
12  br label %while.cond
13
14while.cond:
15  %res.0 = phi ptr [ null, %entry ], [ @i, %if.then ], [ @f, %if.else ]
16  %0 = load i32, ptr @cmp, align 4
17  %shr = ashr i32 %0, 1
18  store i32 %shr, ptr @cmp, align 4
19  %tobool = icmp ne i32 %shr, 0
20  br i1 %tobool, label %while.body, label %while.end
21
22while.body:
23  %and = and i32 %shr, 1
24  %tobool1 = icmp ne i32 %and, 0
25  br i1 %tobool1, label %if.then, label %if.else
26
27if.then:
28  br label %while.cond
29
30if.else:
31  br label %while.cond
32
33while.end:
34  store ptr %res.0, ptr @resf, align 8
35  store ptr %res.0, ptr @resi, align 8
36  ret i32 0
37
38; CHECK-NOT: bitcast i32
39}
40
41