[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / llvm / test / LTO / X86 / unified-cfi.ll
blobf404136ca35f136d170323be0570b2debdc4f479
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
5 ; CHECK-LABEL: main
7 ; CHECK: jbe
8 ; CHECK-NEXT: ud2
9 ; CHECK-NEXT: ud2
11 ; ModuleID = 'llvm/test/LTO/X86/unified-cfi.ll'
12 source_filename = "cfi.cpp"
13 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
14 target triple = "x86_64-scei-ps4"
16 @func = hidden global [3 x i32 ()*] [i32 ()* @_Z1av, i32 ()* @_Z1bv, i32 ()* @_Z1cv], align 16
17 @.src = private unnamed_addr constant [8 x i8] c"cfi.cpp\00", align 1
18 @anon.9260195284c792ab5c6ef4d97bfcf95d.0 = private unnamed_addr constant { i16, i16, [9 x i8] } { i16 -1, i16 0, [9 x i8] c"'int ()'\00" }
20 ; Function Attrs: noinline nounwind optnone sspstrong uwtable
21 define hidden i32 @_Z1av() #0 !type !3 !type !4 {
22 entry:
23   ret i32 1
26 ; Function Attrs: noinline nounwind optnone sspstrong uwtable
27 define hidden i32 @_Z1bv() #0 !type !3 !type !4 {
28 entry:
29   ret i32 2
32 ; Function Attrs: noinline nounwind optnone sspstrong uwtable
33 define hidden i32 @_Z1cv() #0 !type !3 !type !4 {
34 entry:
35   ret i32 3
38 ; Function Attrs: noinline norecurse nounwind optnone sspstrong uwtable
39 define hidden i32 @main(i32 %argc, i8** %argv) #1 !type !5 !type !6 {
40 entry:
41   %retval = alloca i32, align 4
42   %argc.addr = alloca i32, align 4
43   %argv.addr = alloca i8**, align 8
44   store i32 0, i32* %retval, align 4
45   store i32 %argc, i32* %argc.addr, align 4
46   store i8** %argv, i8*** %argv.addr, align 8
47   %0 = load i32, i32* %argc.addr, align 4
48   %idxprom = sext i32 %0 to i64
49   %arrayidx = getelementptr inbounds [3 x i32 ()*], [3 x i32 ()*]* @func, i64 0, i64 %idxprom
50   %1 = load i32 ()*, i32 ()** %arrayidx, align 8
51   %2 = bitcast i32 ()* %1 to i8*, !nosanitize !7
52   %3 = call i1 @llvm.type.test(i8* %2, metadata !"_ZTSFivE"), !nosanitize !7
53   br i1 %3, label %cont, label %trap, !nosanitize !7
55 trap:                                             ; preds = %entry
56   call void @llvm.trap() #4, !nosanitize !7
57   unreachable, !nosanitize !7
59 cont:                                             ; preds = %entry
60   %call = call i32 %1()
61   ret i32 %call
64 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
65 declare i1 @llvm.type.test(i8*, metadata) #2
67 ; Function Attrs: cold noreturn nounwind
68 declare void @llvm.trap() #3
70 attributes #0 = { noinline nounwind optnone sspstrong uwtable }
71 attributes #1 = { noinline norecurse nounwind optnone sspstrong uwtable }
72 attributes #2 = { nofree nosync nounwind readnone speculatable willreturn }
73 attributes #3 = { cold noreturn nounwind }
74 attributes #4 = { noreturn nounwind }
76 !llvm.module.flags = !{!0, !1}
77 !llvm.ident = !{!2}
79 !0 = !{i32 1, !"wchar_size", i32 2}
80 !1 = !{i32 7, !"PIC Level", i32 2}
81 !2 = !{!"clang version 7.0.0 (PS4 clang version 99.99.0.1562 432a534f checking)"}
82 !3 = !{i64 0, !"_ZTSFivE"}
83 !4 = !{i64 0, !"_ZTSFivE.generalized"}
84 !5 = !{i64 0, !"_ZTSFiiPPcE"}
85 !6 = !{i64 0, !"_ZTSFiiPvE.generalized"}
86 !7 = !{}