1; Check that we don't crash when processing declaration with type metadata 2; RUN: opt -S -wholeprogramdevirt -whole-program-visibility %s 3 4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-none-linux-gnu" 6 7declare i1 @llvm.type.test(i8*, metadata) 8declare void @llvm.assume(i1) 9 10@_ZTVN3foo3barE = external dso_local unnamed_addr constant { [8 x i8*] }, align 8, !type !0 11 12define i1 @call1(i8* %obj) { 13 %vtableptr = bitcast i8* %obj to [3 x i8*]** 14 %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr 15 %vtablei8 = bitcast [3 x i8*]* %vtable to i8* 16 %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid") 17 call void @llvm.assume(i1 %p) 18 %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 0 19 %fptr = load i8*, i8** %fptrptr 20 %fptr_casted = bitcast i8* %fptr to i1 (i8*)* 21 %result = call i1 %fptr_casted(i8* %obj) 22 ret i1 %result 23} 24 25!0 = !{i64 16, !"_ZTSN3foo3barE"} 26