Home | History | Annotate | Download | only in GlobalOpt
      1 ; RUN: opt < %s -S -globalopt -instcombine | FileCheck %s
      2 ;; check that global opt turns integers that only hold 0 or 1 into bools.
      3 
      4 @G = internal addrspace(1) global i32 0
      5 ; CHECK: @G
      6 ; CHECK: addrspace(1)
      7 ; CHECK: global i1 false
      8 
      9 define void @set1() {
     10   store i32 0, i32 addrspace(1)* @G
     11 ; CHECK: store i1 false
     12   ret void
     13 }
     14 
     15 define void @set2() {
     16   store i32 1, i32 addrspace(1)* @G
     17 ; CHECK: store i1 true
     18   ret void
     19 }
     20 
     21 define i1 @get() {
     22 ; CHECK-LABEL: @get(
     23   %A = load i32, i32 addrspace(1) * @G
     24   %C = icmp slt i32 %A, 2
     25   ret i1 %C
     26 ; CHECK: ret i1 true
     27 }
     28 
     29