106 lines · plain
1;; Test fixup of largest cold contexts.2 3;; This case has multiple recursive cycles in the cold context, which can be4;; made non-recursive with the inlining in the code.5 6;; -stats requires asserts7; REQUIRES: asserts8 9;; First try disabling detection of the largest cold contexts.10;; We will not get any cloning.11; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \12; RUN: -memprof-top-n-important=0 \13; RUN: -memprof-verify-ccg -memprof-verify-nodes -stats \14; RUNL -pass-remarks=memprof-context-disambiguation \15; RUN: %s -S 2>&1 | FileCheck %s --implicit-check-not="created clone" \16; RUN: --implicit-check-not="Number of cold static allocations" \17; RUN: --implicit-check-not="Number of function clones" \18; RUN: --implicit-check-not="Number of important context ids" \19; RUN: --implicit-check-not="Number of fixup"20 21;; Allow default detection of the largest cold contexts, but disable fixup.22;; We should find 1 important context, but still not get cloning.23; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \24; RUN: -memprof-fixup-important=false \25; RUN: -memprof-verify-ccg -memprof-verify-nodes -stats \26; RUNL -pass-remarks=memprof-context-disambiguation \27; RUN: %s -S 2>&1 | FileCheck %s --check-prefix=TOPN1-NOFIXUP \28; RUN: --implicit-check-not="created clone" \29; RUN: --implicit-check-not="Number of cold static allocations" \30; RUN: --implicit-check-not="Number of function clones" \31; RUN: --implicit-check-not="Number of fixup"32 33; TOPN1-NOFIXUP: 1 memprof-context-disambiguation - Number of important context ids34 35;; Allow default detection of largest cold contexts, fixup is enabled by default.36;; This case should get fixup and cloning.37; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \38; RUN: -memprof-verify-ccg -memprof-verify-nodes -stats \39; RUN: -pass-remarks=memprof-context-disambiguation \40; RUN: %s -S 2>&1 | FileCheck %s --check-prefix=TOPN141 42; TOPN1: created clone E.memprof.143; TOPN1: created clone DB.memprof.144; TOPN1: created clone CB.memprof.145; TOPN1: created clone A.memprof.146; TOPN1: call in clone main assigned to call function clone A.memprof.147; TOPN1: call in clone A.memprof.1 assigned to call function clone CB.memprof.148; TOPN1: call in clone CB.memprof.1 assigned to call function clone DB.memprof.149; TOPN1: call in clone DB.memprof.1 assigned to call function clone E.memprof.150; TOPN1: call in clone E.memprof.1 marked with memprof allocation attribute cold51; TOPN1: call in clone E marked with memprof allocation attribute notcold52 53; TOPN1: 1 memprof-context-disambiguation - Number of contexts with fixed edges54; TOPN1: 2 memprof-context-disambiguation - Number of fixup edges added55; TOPN1: 1 memprof-context-disambiguation - Number of important context ids56 57target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"58target triple = "x86_64-unknown-linux-gnu"59 60define void @E() {61entry:62 %call = tail call ptr @_Znam(i64 10), !memprof !7, !callsite !1463 ret void64}65 66define void @DB() {67entry:68 tail call void @E(), !callsite !1769 ret void70}71 72define void @CB() {73entry:74 tail call void @DB(), !callsite !2275 ret void76}77 78define void @A() {79entry:80 tail call void @CB(), !callsite !2081 ret void82}83 84define i32 @main() {85entry:86 tail call void @A(), !callsite !2587 tail call void @A(), !callsite !2788 ret i32 089}90 91declare ptr @_Znam(i64)92 93!7 = !{!8, !10}94!8 = !{!9, !"cold", !2}95!9 = !{i64 123, i64 234, i64 345, i64 234, i64 456, i64 234, i64 567, i64 678}96!2 = !{i64 12345, i64 200}97!10 = !{!11, !"notcold", !3}98!3 = !{i64 23456, i64 200}99!11 = !{i64 123, i64 234, i64 345, i64 234, i64 456, i64 234, i64 567, i64 789}100!14 = !{i64 123}101!17 = !{i64 234, i64 345}102!22 = !{i64 234, i64 456}103!20 = !{i64 234, i64 567}104!25 = !{i64 678}105!27 = !{i64 789}106