1 ; REQUIRES: x86-registered-target
3 ;; Test that passing -supports-hot-cold-new to the thin link prevents memprof
4 ;; metadata and attributes from being removed from the distributed ThinLTO
5 ;; backend, and vice versa without passing -supports-hot-cold-new.
7 ;; First check with -supports-hot-cold-new.
8 ; RUN: opt -thinlto-bc %s >%t.o
9 ; RUN: llvm-lto2 run %t.o -save-temps \
10 ; RUN: -supports-hot-cold-new \
11 ; RUN: -thinlto-distributed-indexes \
12 ; RUN: -r=%t.o,main,plx \
13 ; RUN: -r=%t.o,_Znam, \
16 ;; Ensure that the index file reflects the -supports-hot-cold-new, as that is
17 ;; how the ThinLTO backend behavior is controlled.
18 ; RUN: llvm-dis %t.out.index.bc -o - | FileCheck %s --check-prefix=CHECK-INDEX-ON
19 ;; Flags are printed in decimal, but this corresponds to 0x161, and 0x100 is
20 ;; the value indicating -supports-hot-cold-new was enabled.
21 ; CHECK-INDEX-ON: flags: 353
23 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t1.o -x ir %t.o -c -fthinlto-index=%t.o.thinlto.bc -save-temps=obj
25 ; RUN: llvm-dis %t.s.3.import.bc -o - | FileCheck %s --check-prefix=CHECK-IR
26 ; CHECK-IR: !memprof {{.*}} !callsite
27 ; CHECK-IR: "memprof"="cold"
29 ;; Next check without -supports-hot-cold-new, we should not perform
30 ;; context disambiguation, and we should strip memprof metadata and
31 ;; attributes before optimization during the distributed backend.
32 ; RUN: llvm-lto2 run %t.o -save-temps \
33 ; RUN: -thinlto-distributed-indexes \
34 ; RUN: -r=%t.o,main,plx \
35 ; RUN: -r=%t.o,_Znam, \
38 ;; Ensure that the index file reflects not having -supports-hot-cold-new.
39 ; RUN: llvm-dis %t.out.index.bc -o - | FileCheck %s --check-prefix=CHECK-INDEX-OFF
40 ;; Flags are printed in decimal, but this corresponds to 0x61, without 0x100 set.
41 ; CHECK-INDEX-OFF: flags: 97
43 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t1.o -x ir %t.o -c -fthinlto-index=%t.o.thinlto.bc -save-temps=obj
45 ; RUN: llvm-dis %t.s.3.import.bc -o - | FileCheck %s \
46 ; RUN: --implicit-check-not "!memprof" --implicit-check-not "!callsite" \
47 ; RUN: --implicit-check-not "memprof"="cold"
49 source_filename = "thinlto-distributed-supports-hot-cold-new.ll"
50 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
51 target triple = "x86_64-unknown-linux-gnu"
53 define i32 @main() #0 {
55 %call = call ptr @_Znam(i64 0), !memprof !0, !callsite !5
56 %call1 = call ptr @_Znam(i64 0) #1
60 declare ptr @_Znam(i64)
62 attributes #0 = { noinline optnone }
63 attributes #1 = { "memprof"="cold" }
66 !1 = !{!2, !"notcold"}
67 !2 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 8632435727821051414}
69 !4 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 -3421689549917153178}
70 !5 = !{i64 9086428284934609951}