1; RUN: opt -S -wholeprogramdevirt -pass-remarks=wholeprogramdevirt %s 2>&1 | FileCheck %s 2 3target datalayout = "e-p:64:64" 4target triple = "x86_64-unknown-linux-gnu" 5 6; CHECK: remark: <unknown>:0:0: devirtualized call 7; CHECK-NOT: devirtualized call 8 9@vt1 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0 10@vt2 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0 11 12define void @vf(i8* %this) { 13 ret void 14} 15 16; CHECK: define void @call 17define void @call(i8* %obj) { 18 %vtableptr = bitcast i8* %obj to [1 x i8*]** 19 %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr 20 %vtablei8 = bitcast [1 x i8*]* %vtable to i8* 21 %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 0, metadata !"typeid") 22 %fptr = extractvalue {i8*, i1} %pair, 0 23 %p = extractvalue {i8*, i1} %pair, 1 24 ; CHECK: br i1 true, 25 br i1 %p, label %cont, label %trap 26 27cont: 28 %fptr_casted = bitcast i8* %fptr to void (i8*)* 29 ; CHECK: call void @vf( 30 call void %fptr_casted(i8* %obj) 31 ret void 32 33trap: 34 call void @llvm.trap() 35 unreachable 36} 37 38declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata) 39declare void @llvm.trap() 40 41!0 = !{i32 0, !"typeid"} 42