1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/Transforms/LowerBitSets/nonstring.ll
Peter Collingbourne 04c6c402ba LowerBitSets: Fix non-determinism bug.
Visit disjoint sets in a deterministic order based on the maximum BitSetNM
index, otherwise the order in which we visit them will depend on pointer
comparisons. This was being exposed by MSan.

llvm-svn: 247201
2015-09-09 22:30:32 +00:00

35 lines
897 B
LLVM

; RUN: opt -S -lowerbitsets < %s | FileCheck %s
; Tests that non-string metadata nodes may be used as bitset identifiers.
target datalayout = "e-p:32:32"
; CHECK: @[[ANAME:.*]] = private constant { i32 }
; CHECK: @[[BNAME:.*]] = private constant { [2 x i32] }
@a = constant i32 1
@b = constant [2 x i32] [i32 2, i32 3]
!0 = !{!2, i32* @a, i32 0}
!1 = !{!3, [2 x i32]* @b, i32 0}
!2 = distinct !{}
!3 = distinct !{}
!llvm.bitsets = !{ !0, !1 }
declare i1 @llvm.bitset.test(i8* %ptr, metadata %bitset) nounwind readnone
; CHECK-LABEL: @foo
define i1 @foo(i8* %p) {
; CHECK: icmp eq i32 {{.*}}, ptrtoint ({ i32 }* @[[ANAME]] to i32)
%x = call i1 @llvm.bitset.test(i8* %p, metadata !2)
ret i1 %x
}
; CHECK-LABEL: @bar
define i1 @bar(i8* %p) {
; CHECK: icmp eq i32 {{.*}}, ptrtoint ({ [2 x i32] }* @[[BNAME]] to i32)
%x = call i1 @llvm.bitset.test(i8* %p, metadata !3)
ret i1 %x
}