brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · fe2a002 Raw
103 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; RUN: split-file %s %t7 8;; First check with -supports-hot-cold-new.9; RUN: opt -thinlto-bc %t/main.ll >%t/main.o10; RUN: opt -thinlto-bc %t/foo.ll >%t/foo.o11; RUN: llvm-lto2 run %t/main.o %t/foo.o -enable-memprof-context-disambiguation \12; RUN:	-supports-hot-cold-new \13; RUN:	-r=%t/main.o,main,plx \14; RUN:	-r=%t/main.o,bar,plx \15; RUN:	-r=%t/main.o,foo, \16; RUN:	-r=%t/main.o,_Znam, \17; RUN:	-r=%t/foo.o,foo,plx \18; RUN:	-r=%t/foo.o,_Znam, \19; RUN:	-memprof-dump-ccg \20; RUN:	-print-before=memprof-context-disambiguation \21; RUN:	-thinlto-threads=1 \22; RUN:	-o %t.out 2>&1 | FileCheck %s --check-prefix=DUMP --check-prefix=IR23 24; DUMP: Callsite Context Graph:25 26; IR: @main()27; IR: !memprof {{.*}} !callsite28; IR: @_Znam(i64 0) #[[ATTR:[0-9]+]]29; IR: @bar()30; IR: !memprof {{.*}} !callsite31; IR: @_Znam(i64 0) #[[ATTR:[0-9]+]]32; IR: attributes #[[ATTR]] = { "memprof"="cold" }33 34;; Next check without -supports-hot-cold-new, we should not perform35;; context disambiguation, and we should strip memprof metadata and36;; attributes before optimization.37; RUN: llvm-lto2 run %t/main.o %t/foo.o -enable-memprof-context-disambiguation \38; RUN:	-r=%t/main.o,main,plx \39; RUN:	-r=%t/main.o,bar,plx \40; RUN:	-r=%t/main.o,foo, \41; RUN:	-r=%t/main.o,_Znam, \42; RUN:	-r=%t/foo.o,foo,plx \43; RUN:	-r=%t/foo.o,_Znam, \44; RUN:	-memprof-dump-ccg \45; RUN:	-print-before=memprof-context-disambiguation \46; RUN:	-thinlto-threads=1 \47; RUN:	-o %t.out 2>&1 | FileCheck %s --allow-empty \48; RUN:  --implicit-check-not "Callsite Context Graph:" \49; RUN: 	--implicit-check-not "!memprof" --implicit-check-not "!callsite" \50; RUN: 	--implicit-check-not "memprof"="cold"51 52;--- main.ll53target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"54target triple = "x86_64-unknown-linux-gnu"55 56define i32 @main() #0 {57entry:58  %call = call ptr @_Znam(i64 0), !memprof !0, !callsite !559  %call2 = call ptr @_Znam(i64 0) #160  ret i32 061}62 63define void @bar() {64  call void @foo()65  ret void66}67 68declare void @foo()69 70declare ptr @_Znam(i64)71 72attributes #0 = { noinline optnone }73attributes #1 = { "memprof"="cold" }74 75!0 = !{!1, !3}76!1 = !{!2, !"notcold"}77!2 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 8632435727821051414}78!3 = !{!4, !"cold"}79!4 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 -3421689549917153178}80!5 = !{i64 9086428284934609951}81 82;--- foo.ll83target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"84target triple = "x86_64-unknown-linux-gnu"85 86define i32 @foo() {87entry:88  %call = call ptr @_Znam(i64 0), !memprof !0, !callsite !589  %call2 = call ptr @_Znam(i64 0) #190  ret i32 091}92 93declare ptr @_Znam(i64)94 95attributes #1 = { "memprof"="cold" }96 97!0 = !{!1, !3}98!1 = !{!2, !"notcold"}99!2 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 8632435727821051414}100!3 = !{!4, !"cold"}101!4 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 -3421689549917153178}102!5 = !{i64 9086428284934609951}103