brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · e0bcd28 Raw
101 lines · plain
1;; Test to ensure a call to a different callee but with the same debug info2;; (and therefore callsite metadata) as a preceding tail call in the alloc3;; context does not cause missing or incorrect cloning. This test is otherwise4;; the same as tailcall.ll.5 6;; -stats requires asserts7; REQUIRES: asserts8 9; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \10; RUN:  -stats %s -S 2>&1 | FileCheck %s --check-prefix=STATS --check-prefix=IR11 12source_filename = "tailcall-aliased-location1.cc"13target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"14target triple = "x86_64-unknown-linux-gnu"15 16@a = dso_local global [2 x ptr] [ptr @_Z2a1v, ptr @_Z2a2v], align 1617 18declare void @_Z2a1v() #019 20declare void @_Z2a2v() #021 22; Function Attrs: noinline23; IR-LABEL: @_Z3barv()24define ptr @_Z3barv() local_unnamed_addr #0 {25entry:26  ; IR: call ptr @_Znam(i64 10) #[[NOTCOLD:[0-9]+]]27  %call = tail call ptr @_Znam(i64 10) #2, !memprof !0, !callsite !528  ret ptr %call29}30 31; Function Attrs: nobuiltin allocsize(0)32declare ptr @_Znam(i64) #133declare void @blah()34 35; Function Attrs: noinline36; IR-LABEL: @_Z3bazv()37define ptr @_Z3bazv() #0 {38entry:39  ; IR: call ptr @_Z3barv()40  %call = tail call ptr @_Z3barv()41  ret ptr %call42}43 44; Function Attrs: noinline45; IR-LABEL: @_Z3foov()46define ptr @_Z3foov() #0 {47entry:48  ; IR: call ptr @_Z3bazv()49  %call = tail call ptr @_Z3bazv()50  ret ptr %call51}52 53; Function Attrs: noinline54; IR-LABEL: @main()55define i32 @main() #0 {56  ;; Preceding call to another callee but with the same debug location / callsite id57  call void @blah(), !callsite !658  ;; The first call to foo is part of a cold context, and should use the59  ;; original functions.60  ;; allocation. The latter should call the cloned functions.61  ; IR: call ptr @_Z3foov()62  %call = tail call ptr @_Z3foov(), !callsite !663  ;; The second call to foo is part of a cold context, and should call the64  ;; cloned functions.65  ; IR: call ptr @_Z3foov.memprof.1()66  %call1 = tail call ptr @_Z3foov(), !callsite !767  %2 = load ptr, ptr @a, align 1668  call void %2(), !callsite !1069  ret i32 070}71 72; IR-LABEL: @_Z3barv.memprof.1()73; IR: call ptr @_Znam(i64 10) #[[COLD:[0-9]+]]74; IR-LABEL: @_Z3bazv.memprof.1()75; IR: call ptr @_Z3barv.memprof.1()76; IR-LABEL: @_Z3foov.memprof.1()77; IR: call ptr @_Z3bazv.memprof.1()78 79; IR: attributes #[[NOTCOLD]] = { builtin allocsize(0) "memprof"="notcold" }80; IR: attributes #[[COLD]] = { builtin allocsize(0) "memprof"="cold" }81 82; STATS: 2 memprof-context-disambiguation - Number of profiled callees found via tail calls83; STATS: 4 memprof-context-disambiguation - Aggregate depth of profiled callees found via tail calls84; STATS: 2 memprof-context-disambiguation - Maximum depth of profiled callees found via tail calls85 86attributes #0 = { noinline }87attributes #1 = { nobuiltin allocsize(0) }88attributes #2 = { builtin allocsize(0) }89 90!0 = !{!1, !3, !8}91!1 = !{!2, !"notcold"}92!2 = !{i64 3186456655321080972, i64 8632435727821051414}93!3 = !{!4, !"cold"}94!4 = !{i64 3186456655321080972, i64 -3421689549917153178}95!5 = !{i64 3186456655321080972}96!6 = !{i64 8632435727821051414}97!7 = !{i64 -3421689549917153178}98!8 = !{!9, !"notcold"}99!9 = !{i64 3186456655321080972, i64 1}100!10 = !{i64 1}101