1; RUN: opt -S -passes=lowertypetests -mtriple=x86_64-unknown-linux-gnu %s | FileCheck --check-prefix=X64 %s 2; RUN: opt -S -passes=lowertypetests -mtriple=wasm32-unknown-unknown %s | FileCheck --check-prefix=WASM32 %s 3 4; Tests that we correctly handle bitsets with disjoint call target sets. 5 6target datalayout = "e-p:64:64" 7 8; X64: @f = alias void (), ptr @[[JT0:.*]] 9; X64: @g = alias void (), ptr @[[JT1:.*]] 10 11; WASM32: private constant [0 x i8] zeroinitializer 12@0 = private unnamed_addr constant [2 x ptr] [ptr @f, ptr @g], align 16 13 14; X64: define hidden void @f.cfi() 15; WASM32: define void @f() !type !{{[0-9]+}} !wasm.index ![[I0:[0-9]+]] 16define void @f() !type !0 { 17 ret void 18} 19 20; X64: define hidden void @g.cfi() 21; WASM32: define void @g() !type !{{[0-9]+}} !wasm.index ![[I1:[0-9]+]] 22define void @g() !type !1 { 23 ret void 24} 25 26!0 = !{i32 0, !"typeid1"} 27!1 = !{i32 0, !"typeid2"} 28 29declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone 30 31define i1 @foo(ptr %p) { 32 ; X64: icmp eq i64 {{.*}}, ptrtoint (ptr @[[JT0]] to i64) 33 ; WASM32: icmp eq i64 {{.*}}, ptrtoint (ptr getelementptr (i8, ptr null, i64 1) to i64) 34 %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") 35 ; X64: icmp eq i64 {{.*}}, ptrtoint (ptr @[[JT1]] to i64) 36 ; WASM32: icmp eq i64 {{.*}}, ptrtoint (ptr getelementptr (i8, ptr null, i64 2) to i64) 37 %y = call i1 @llvm.type.test(ptr %p, metadata !"typeid2") 38 %z = add i1 %x, %y 39 ret i1 %z 40} 41 42; X64: define private void @[[JT0]]() #{{.*}} align 8 { 43; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @f.cfi) 44 45; X64: define private void @[[JT1]]() #{{.*}} align 8 { 46; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @g.cfi) 47 48; WASM32: ![[I0]] = !{i64 1} 49; WASM32: ![[I1]] = !{i64 2} 50