blob: 9fbbe357617d73c5d838806c8a1e7809852fd3d6 [file] [log] [blame]
Tanya Lattnerec9a35a2008-03-01 09:15:35 +00001; RUN: llvm-as < %s | opt -globalopt -instcombine | \
Reid Spencer2aabd072007-04-15 08:30:33 +00002; RUN: llvm-dis | grep {ret i1 true}
Chris Lattneref07cc52004-12-12 05:52:12 +00003
4;; check that global opt turns integers that only hold 0 or 1 into bools.
5
Tanya Lattnerec9a35a2008-03-01 09:15:35 +00006@G = internal global i32 0 ; <i32*> [#uses=3]
Chris Lattneref07cc52004-12-12 05:52:12 +00007
Tanya Lattnerec9a35a2008-03-01 09:15:35 +00008define void @set1() {
9 store i32 0, i32* @G
10 ret void
Chris Lattneref07cc52004-12-12 05:52:12 +000011}
12
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000013define void @set2() {
14 store i32 1, i32* @G
15 ret void
Chris Lattneref07cc52004-12-12 05:52:12 +000016}
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000017
18define i1 @get() {
19 %A = load i32* @G ; <i32> [#uses=1]
20 %C = icmp slt i32 %A, 2 ; <i1> [#uses=1]
21 ret i1 %C
22}
23