69 lines · plain
1;; Test that passing -supports-hot-cold-new to the LTO link allows context2;; disambiguation to proceed, and also prevents memprof metadata and attributes3;; from being removed from the LTO backend, and vice versa without passing4;; -supports-hot-cold-new.5 6;; Note that this tests regular LTO (with a summary) due to the module flag7;; disabling ThinLTO.8 9;; First check with -supports-hot-cold-new.10; RUN: opt -module-summary %s >%t.o11; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \12; RUN: -supports-hot-cold-new \13; RUN: -r=%t.o,main,plx \14; RUN: -r=%t.o,_Znam, \15; RUN: -memprof-dump-ccg \16; RUN: -print-before=memprof-context-disambiguation \17; RUN: -o %t.out 2>&1 | FileCheck %s --check-prefix=DUMP --check-prefix=IR18 19; IR: !memprof {{.*}} !callsite20; IR: "memprof"="cold"21 22; DUMP: Callsite Context Graph:23 24;; Next check without -supports-hot-cold-new, we should not perform25;; context disambiguation, and we should strip memprof metadata and26;; attributes before optimization.27; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \28; RUN: -r=%t.o,main,plx \29; RUN: -r=%t.o,_Znam, \30; RUN: -memprof-dump-ccg \31; RUN: -print-before=memprof-context-disambiguation \32; RUN: -o %t.out 2>&1 | FileCheck %s --allow-empty \33; RUN: --implicit-check-not "Callsite Context Graph:" \34; RUN: --implicit-check-not "!memprof" --implicit-check-not "!callsite" \35; RUN: --implicit-check-not "memprof"="cold"36 37;; Ensure the attributes and metadata are stripped when running a non-LTO pipeline.38; RUN: opt -O3 %t.o -S | FileCheck %s \39; RUN: --implicit-check-not "!memprof" --implicit-check-not "!callsite" \40; RUN: --implicit-check-not "memprof"="cold"41 42source_filename = "memprof-supports-hot-cold-new.ll"43target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"44target triple = "x86_64-unknown-linux-gnu"45 46define i32 @main() #0 {47entry:48 %call = call ptr @_Znam(i64 0), !memprof !0, !callsite !549 %call2 = call ptr @_Znam(i64 0) #150 ret i32 051}52 53declare ptr @_Znam(i64)54 55attributes #0 = { noinline optnone }56attributes #1 = { "memprof"="cold" }57 58!llvm.module.flags = !{!6}59 60!0 = !{!1, !3}61!1 = !{!2, !"notcold"}62!2 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 8632435727821051414}63!3 = !{!4, !"cold"}64!4 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 -3421689549917153178}65!5 = !{i64 9086428284934609951}66 67;; Force regular LTO even though we have a summary.68!6 = !{i32 1, !"ThinLTO", i32 0}69