64 lines · plain
1;; Test handling of memprof distributed ThinLTO when the call to update is an alias.2 3;; Preparation steps to generate the bitcode and perform the thin link.4; RUN: opt -thinlto-bc %s >%t.o5; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \6; RUN: -supports-hot-cold-new \7; RUN: -thinlto-distributed-indexes \8; RUN: -r=%t.o,main,plx \9; RUN: -r=%t.o,_Znam, \10; RUN: -o %t2.out11 12;; Run ThinLTO backend13; RUN: opt -passes=memprof-context-disambiguation \14; RUN: -memprof-import-summary=%t.o.thinlto.bc \15; RUN: -pass-remarks=memprof-context-disambiguation \16; RUN: %t.o -S 2>&1 | FileCheck %s --check-prefix=IR17 18source_filename = "memprof-distrib-alias.ll"19target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"20target triple = "x86_64-unknown-linux-gnu"21 22define i32 @main() #0 {23entry:24 ;; The first call to fooAlias does not allocate cold memory. It should call25 ;; the original function alias, which calls the original allocation decorated26 ;; with a "notcold" attribute.27 ; IR: call {{.*}} @_Z8fooAliasv()28 %call = call ptr @_Z8fooAliasv(), !callsite !029 ;; The second call to fooAlias allocates cold memory. It should call the30 ;; cloned function which calls a cloned allocation decorated with a "cold"31 ;; attribute.32 ; IR: call {{.*}} @_Z3foov.memprof.1()33 %call1 = call ptr @_Z8fooAliasv(), !callsite !134 ret i32 035}36 37; IR: define internal {{.*}} @_Z3foov()38; IR: call {{.*}} @_Znam(i64 0) #[[NOTCOLD:[0-9]+]]39; IR: define internal {{.*}} @_Z3foov.memprof.1()40; IR: call {{.*}} @_Znam(i64 0) #[[COLD:[0-9]+]]41; IR: attributes #[[NOTCOLD]] = { "memprof"="notcold" }42; IR: attributes #[[COLD]] = { "memprof"="cold" }43 44declare ptr @_Znam(i64)45 46@_Z8fooAliasv = internal alias ptr (...), ptr @_Z3foov47 48define internal ptr @_Z3foov() #0 {49entry:50 %call = call ptr @_Znam(i64 0), !memprof !2, !callsite !751 ret ptr null52}53 54attributes #0 = { noinline optnone }55 56!0 = !{i64 8632435727821051414}57!1 = !{i64 -3421689549917153178}58!2 = !{!3, !5}59!3 = !{!4, !"notcold"}60!4 = !{i64 9086428284934609951, i64 8632435727821051414}61!5 = !{!6, !"cold"}62!6 = !{i64 9086428284934609951, i64 -3421689549917153178}63!7 = !{i64 9086428284934609951}64