1; Test for the expected CFI codegen in a module with CFI metadata. 2; RUN: opt -unified-lto -thinlto-bc -o %t0.o %s 3; RUN: llvm-lto --exported-symbol=main -filetype=asm -o - %t0.o | FileCheck %s 4 5; CHECK-LABEL: main 6 7; CHECK: jbe 8; CHECK-NEXT: ud2 9 10; ModuleID = 'llvm/test/LTO/X86/unified-cfi.ll' 11source_filename = "cfi.cpp" 12target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 13target triple = "x86_64-scei-ps4" 14 15@func = hidden global [3 x i32 ()*] [i32 ()* @_Z1av, i32 ()* @_Z1bv, i32 ()* @_Z1cv], align 16 16@.src = private unnamed_addr constant [8 x i8] c"cfi.cpp\00", align 1 17@anon.9260195284c792ab5c6ef4d97bfcf95d.0 = private unnamed_addr constant { i16, i16, [9 x i8] } { i16 -1, i16 0, [9 x i8] c"'int ()'\00" } 18 19; Function Attrs: noinline nounwind optnone sspstrong uwtable 20define hidden i32 @_Z1av() #0 !type !3 !type !4 { 21entry: 22 ret i32 1 23} 24 25; Function Attrs: noinline nounwind optnone sspstrong uwtable 26define hidden i32 @_Z1bv() #0 !type !3 !type !4 { 27entry: 28 ret i32 2 29} 30 31; Function Attrs: noinline nounwind optnone sspstrong uwtable 32define hidden i32 @_Z1cv() #0 !type !3 !type !4 { 33entry: 34 ret i32 3 35} 36 37; Function Attrs: noinline norecurse nounwind optnone sspstrong uwtable 38define hidden i32 @main(i32 %argc, i8** %argv) #1 !type !5 !type !6 { 39entry: 40 %retval = alloca i32, align 4 41 %argc.addr = alloca i32, align 4 42 %argv.addr = alloca i8**, align 8 43 store i32 0, i32* %retval, align 4 44 store i32 %argc, i32* %argc.addr, align 4 45 store i8** %argv, i8*** %argv.addr, align 8 46 %0 = load i32, i32* %argc.addr, align 4 47 %idxprom = sext i32 %0 to i64 48 %arrayidx = getelementptr inbounds [3 x i32 ()*], [3 x i32 ()*]* @func, i64 0, i64 %idxprom 49 %1 = load i32 ()*, i32 ()** %arrayidx, align 8 50 %2 = bitcast i32 ()* %1 to i8*, !nosanitize !7 51 %3 = call i1 @llvm.type.test(i8* %2, metadata !"_ZTSFivE"), !nosanitize !7 52 br i1 %3, label %cont, label %trap, !nosanitize !7 53 54trap: ; preds = %entry 55 call void @llvm.trap() #4, !nosanitize !7 56 unreachable, !nosanitize !7 57 58cont: ; preds = %entry 59 %call = call i32 %1() 60 ret i32 %call 61} 62 63; Function Attrs: nofree nosync nounwind readnone speculatable willreturn 64declare i1 @llvm.type.test(i8*, metadata) #2 65 66; Function Attrs: cold noreturn nounwind 67declare void @llvm.trap() #3 68 69attributes #0 = { noinline nounwind optnone sspstrong uwtable } 70attributes #1 = { noinline norecurse nounwind optnone sspstrong uwtable } 71attributes #2 = { nofree nosync nounwind readnone speculatable willreturn } 72attributes #3 = { cold noreturn nounwind } 73attributes #4 = { noreturn nounwind } 74 75!llvm.module.flags = !{!0, !1} 76!llvm.ident = !{!2} 77 78!0 = !{i32 1, !"wchar_size", i32 2} 79!1 = !{i32 7, !"PIC Level", i32 2} 80!2 = !{!"clang version 7.0.0 (PS4 clang version 99.99.0.1562 432a534f checking)"} 81!3 = !{i64 0, !"_ZTSFivE"} 82!4 = !{i64 0, !"_ZTSFivE.generalized"} 83!5 = !{i64 0, !"_ZTSFiiPPcE"} 84!6 = !{i64 0, !"_ZTSFiiPvE.generalized"} 85!7 = !{} 86