76 lines · plain
1; REQUIRES: x86-registered-target2 3;; Test that passing -supports-hot-cold-new to the thin link prevents memprof4;; metadata and attributes from being removed from the distributed ThinLTO5;; backend, and vice versa without passing -supports-hot-cold-new.6 7;; First check with -supports-hot-cold-new.8; RUN: opt -thinlto-bc %s >%t.o9; 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, \14; RUN: -o %t.out15 16;; Ensure that the index file reflects the -supports-hot-cold-new, as that is17;; how the ThinLTO backend behavior is controlled.18; RUN: llvm-dis %t.out.index.bc -o - | FileCheck %s --check-prefix=CHECK-INDEX-ON19;; Flags are printed in decimal, but this corresponds to 0x161, and 0x100 is20;; the value indicating -supports-hot-cold-new was enabled.21; CHECK-INDEX-ON: flags: 35322 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=obj24 25; RUN: llvm-dis %t.s.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR26; CHECK-IR: !memprof {{.*}} !callsite27; CHECK-IR: "memprof"="cold"28 29;; Next check without -supports-hot-cold-new, we should not perform30;; context disambiguation, and we should strip memprof metadata and31;; 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, \36; RUN: -o %t.out37 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-OFF40;; Flags are printed in decimal, but this corresponds to 0x61, without 0x100 set.41; CHECK-INDEX-OFF: flags: 9742 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=obj44 45; RUN: llvm-dis %t.s.4.opt.bc -o - | FileCheck %s \46; RUN: --implicit-check-not "!memprof" --implicit-check-not "!callsite" \47; RUN: --implicit-check-not "memprof"="cold"48 49;; Ensure the attributes and metadata are stripped when running a non-LTO pipeline.50; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -x ir %t.o -S -emit-llvm -o - | FileCheck %s \51; RUN: --implicit-check-not "!memprof" --implicit-check-not "!callsite" \52; RUN: --implicit-check-not "memprof"="cold"53 54source_filename = "thinlto-distributed-supports-hot-cold-new.ll"55target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"56target triple = "x86_64-unknown-linux-gnu"57 58define i32 @main() #0 {59entry:60 %call = call ptr @_Znam(i64 0), !memprof !0, !callsite !561 %call1 = call ptr @_Znam(i64 0) #162 ret i32 063}64 65declare ptr @_Znam(i64)66 67attributes #0 = { noinline optnone }68attributes #1 = { "memprof"="cold" }69 70!0 = !{!1, !3}71!1 = !{!2, !"notcold"}72!2 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 8632435727821051414}73!3 = !{!4, !"cold"}74!4 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 -3421689549917153178}75!5 = !{i64 9086428284934609951}76