1 ; RUN: opt -S -lowerbitsets < %s | FileCheck %s 2 3 target datalayout = "e-p:32:32" 4 5 @a = constant i32 1 6 @b = constant [2 x i32] [i32 2, i32 3] 7 8 !0 = !{!"bitset1", i32* @a, i32 0} 9 !1 = !{!"bitset1", [2 x i32]* @b, i32 4} 10 11 !llvm.bitsets = !{ !0, !1 } 12 13 declare i1 @llvm.bitset.test(i8* %ptr, metadata %bitset) nounwind readnone 14 15 ; CHECK: @foo( 16 define i1 @foo() { 17 ; CHECK: ret i1 true 18 %x = call i1 @llvm.bitset.test(i8* bitcast (i32* @a to i8*), metadata !"bitset1") 19 ret i1 %x 20 } 21 22 ; CHECK: @bar( 23 define i1 @bar() { 24 ; CHECK: ret i1 true 25 %x = call i1 @llvm.bitset.test(i8* bitcast (i32* getelementptr ([2 x i32], [2 x i32]* @b, i32 0, i32 1) to i8*), metadata !"bitset1") 26 ret i1 %x 27 } 28 29 ; CHECK: @baz( 30 define i1 @baz() { 31 ; CHECK-NOT: ret i1 true 32 %x = call i1 @llvm.bitset.test(i8* bitcast (i32* getelementptr ([2 x i32], [2 x i32]* @b, i32 0, i32 0) to i8*), metadata !"bitset1") 33 ret i1 %x 34 } 35