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