Home | History | Annotate | Download | only in LowerBitSets
      1 ; RUN: opt -S -lowerbitsets < %s | FileCheck %s
      2 
      3 ; Tests that non-string metadata nodes may be used as bitset identifiers.
      4 
      5 target datalayout = "e-p:32:32"
      6 
      7 ; CHECK: @[[ANAME:.*]] = private constant { i32 }
      8 ; CHECK: @[[BNAME:.*]] = private constant { [2 x i32] }
      9 
     10 @a = constant i32 1
     11 @b = constant [2 x i32] [i32 2, i32 3]
     12 
     13 !0 = !{!2, i32* @a, i32 0}
     14 !1 = !{!3, [2 x i32]* @b, i32 0}
     15 !2 = distinct !{}
     16 !3 = distinct !{}
     17 
     18 !llvm.bitsets = !{ !0, !1 }
     19 
     20 declare i1 @llvm.bitset.test(i8* %ptr, metadata %bitset) nounwind readnone
     21 
     22 ; CHECK-LABEL: @foo
     23 define i1 @foo(i8* %p) {
     24   ; CHECK: icmp eq i32 {{.*}}, ptrtoint ({ i32 }* @[[ANAME]] to i32)
     25   %x = call i1 @llvm.bitset.test(i8* %p, metadata !2)
     26   ret i1 %x
     27 }
     28 
     29 ; CHECK-LABEL: @bar
     30 define i1 @bar(i8* %p) {
     31   ; CHECK: icmp eq i32 {{.*}}, ptrtoint ({ [2 x i32] }* @[[BNAME]] to i32)
     32   %x = call i1 @llvm.bitset.test(i8* %p, metadata !3)
     33   ret i1 %x
     34 }
     35