xref: /llvm-project/llvm/test/ThinLTO/X86/cache-icall.ll (revision c6041283f71e6943e96cfc926da7a2c02bc3ee32)
1; Test that the list of CFI jumptable entries is part of ThinLTO cache key.
2
3; Linking Inputs/cache-icall.ll results in f() being added to CFI jumptable; otherwise it is not.
4; This affects code generated for any users of f(). Make sure that we don't pull a stale object
5; file for %t.o from the cache.
6
7; RUN: opt -module-hash -module-summary -thinlto-bc -thinlto-split-lto-unit %s -o %t.bc
8; RUN: opt -module-hash -module-summary -thinlto-bc -thinlto-split-lto-unit %p/Inputs/cache-icall.ll -o %t2.bc
9
10; RUN: rm -Rf %t.cache && mkdir %t.cache
11
12; RUN: llvm-lto2 run -o %t-no.o %t.bc -cache-dir %t.cache \
13; RUN:   -r=%t.bc,_start,px \
14; RUN:   -r=%t.bc,f,
15
16; RUN: llvm-readelf -s %t-no.o.* | FileCheck %s --check-prefix=SYMBOLS-NO
17
18; RUN: llvm-lto2 run -o %t-yes.o %t.bc %t2.bc -cache-dir %t.cache \
19; RUN:   -r=%t.bc,_start,px \
20; RUN:   -r=%t.bc,f, \
21; RUN:   -r=%t2.bc,f,p
22
23; RUN: llvm-readelf -s %t-yes.o.* | FileCheck %s --check-prefix=SYMBOLS-YES
24
25; SYMBOLS-NO-DAG: {{FUNC .* f.cfi_jt$}}
26; SYMBOLS-NO-DAG: {{NOTYPE .* UND f.cfi_jt$}}
27
28; SYMBOLS-YES-NOT: f.cfi_jt
29; SYMBOLS-YES-DAG: {{FUNC .* f.cfi$}}
30; SYMBOLS-YES-DAG: {{NOTYPE .* UND f.cfi$}}
31
32target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
33target triple = "x86_64-unknown-linux-gnu"
34
35define ptr @_start(ptr %p) !type !0 {
36entry:
37  %0 = tail call i1 @llvm.type.test(ptr %p, metadata !"_ZTSFvvE")
38  br i1 %0, label %cont, label %trap
39
40trap:                                             ; preds = %entry
41  tail call void @llvm.trap()
42  unreachable
43
44cont:                                             ; preds = %entry
45  tail call void %p()
46  ret ptr @f
47}
48
49declare i1 @llvm.type.test(ptr, metadata)
50declare void @llvm.trap()
51declare !type !1 void @f()
52
53!0 = !{i64 0, !"_ZTSFPvPFvvEE"}
54!1 = !{i64 0, !"_ZTSFvvE"}
55