brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.8 KiB · 5213a07 Raw
119 lines · plain
1;; Tests that the compiler ignores smaller contexts that differ only in the2;; IsInlineFrame bool. These map to the same full context id internally, as we3;; ignore the inline frame status which may differ in feedback compiles.4;; Presumably this happens when profiles collected from different binaries are5;; merged. If we didn't pick the largest we would default them all to noncold.6 7;; Avoid failures on big-endian systems that can't read the profile properly8; REQUIRES: x86_64-linux9 10;; Generate the profile and the IR.11; RUN: split-file %s %t12 13;; Generate indexed profile14; RUN: llvm-profdata merge %t/memprof_diff_inline.yaml -o %t.memprofdata15 16; RUN: opt < %t/memprof_diff_inline.ll -passes='memprof-use<profile-filename=%t.memprofdata>' -S -memprof-report-hinted-sizes -memprof-print-match-info 2>&1 | FileCheck %s --check-prefixes=MEMPROF17 18; MEMPROF: MemProf notcold context with id 10194276560488437434 has total profiled size 200 is matched with 1 frames19; MEMPROF: MemProf cold context with id 16342802530253093571 has total profiled size 10000 is matched with 1 frames20 21;--- memprof_diff_inline.yaml22---23HeapProfileRecords:24  - GUID:            _Z3foov25    AllocSites:26      # Small non-cold, full context id 16342802530253093571, should ignore27      - Callstack:28          - { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }29          - { Function: _Z4foo2v, LineOffset: 1, Column: 10, IsInlineFrame: false }30          - { Function: _Z3barv, LineOffset: 1, Column: 10, IsInlineFrame: false }31          - { Function: main, LineOffset: 8, Column: 13, IsInlineFrame: false }32        MemInfoBlock:33          AllocCount:      134          TotalSize:       1035          TotalLifetime:   036          TotalLifetimeAccessDensity: 2000037      # Large cold, full context id 16342802530253093571, should keep38      - Callstack:39          - { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }40          - { Function: _Z4foo2v, LineOffset: 1, Column: 10, IsInlineFrame: true }41          - { Function: _Z3barv, LineOffset: 1, Column: 10, IsInlineFrame: false }42          - { Function: main, LineOffset: 8, Column: 13, IsInlineFrame: false }43        MemInfoBlock:44          AllocCount:      145          TotalSize:       1000046          TotalLifetime:   20000047          TotalLifetimeAccessDensity: 048      # Small non-cold, full context id 16342802530253093571, should ignore49      - Callstack:50          - { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }51          - { Function: _Z4foo2v, LineOffset: 1, Column: 10, IsInlineFrame: false }52          - { Function: _Z3barv, LineOffset: 1, Column: 10, IsInlineFrame: true }53          - { Function: main, LineOffset: 8, Column: 13, IsInlineFrame: false }54        MemInfoBlock:55          AllocCount:      156          TotalSize:       10057          TotalLifetime:   058          TotalLifetimeAccessDensity: 2000059      # Small non-cold, full context id 1019427656048843743460      - Callstack:61          - { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }62          - { Function: _Z4foo2v, LineOffset: 1, Column: 10, IsInlineFrame: false }63          - { Function: _Z3barv, LineOffset: 1, Column: 10, IsInlineFrame: false }64          - { Function: main, LineOffset: 9, Column: 13, IsInlineFrame: false }65        MemInfoBlock:66          AllocCount:      167          TotalSize:       20068          TotalLifetime:   069          TotalLifetimeAccessDensity: 2000070    CallSites:       []71...72;--- memprof_diff_inline.ll73; ModuleID = 'memprof_diff_inline.cc'74source_filename = "memprof_diff_inline.cc"75target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"76target triple = "x86_64-unknown-linux-gnu"77 78%"struct.std::nothrow_t" = type { i8 }79 80@_ZSt7nothrow = external global %"struct.std::nothrow_t", align 181 82define dso_local noundef ptr @_Z3foov() !dbg !10 {83entry:84  ; MEMPROF: call {{.*}} @_Znwm{{.*}} !memprof ![[M1:[0-9]+]], !callsite ![[C1:[0-9]+]]85  %call = call noalias noundef align 32 ptr @_Znwm(i64 noundef 32) #6, !dbg !1386  ret ptr %call87}88 89declare noundef ptr @_Znwm(i64 noundef)90 91attributes #6 = { builtin allocsize(0) }92 93; MEMPROF: ![[M1]] = !{![[MIB1:[0-9]+]], ![[MIB2:[0-9]+]]}94 95; MEMPROF: ![[MIB1]] = !{![[STACK1:[0-9]+]], !"notcold", ![[CONTEXTSIZE1:[0-9]+]]}96; MEMPROF: ![[STACK1]] = !{i64 2732490490862098848, i64 8467819354083268568, i64 9086428284934609951, i64 2061451396820446691}97;; Full context id 10194276560488437434 == -825246751322111418298; MEMPROF: ![[CONTEXTSIZE1]] = !{i64 -8252467513221114182, i64 200}99 100; MEMPROF: ![[MIB2]] = !{![[STACK2:[0-9]+]], !"cold", ![[CONTEXTSIZE2:[0-9]+]]}101; MEMPROF: ![[STACK2]] = !{i64 2732490490862098848, i64 8467819354083268568, i64 9086428284934609951, i64 -5747251260480066785}102;; Full context id 16342802530253093571 == -2103941543456458045103;; We should have kept the large (cold) one.104; MEMPROF: ![[CONTEXTSIZE2]] = !{i64 -2103941543456458045, i64 10000}105 106; MEMPROF: ![[C1]] = !{i64 2732490490862098848}107 108!llvm.dbg.cu = !{!0}109!llvm.module.flags = !{!2, !3}110 111!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git 6cbe6284d1f0a088b5c6482ae27b738f03d82fe7)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None)112!1 = !DIFile(filename: "memprof.cc", directory: "/usr/local/google/home/tejohnson/llvm/tmp", checksumkind: CSK_MD5, checksum: "e8c40ebe4b21776b4d60e9632cbc13c2")113!2 = !{i32 7, !"Dwarf Version", i32 5}114!3 = !{i32 2, !"Debug Info Version", i32 3}115!10 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12)116!11 = !DISubroutineType(types: !12)117!12 = !{}118!13 = !DILocation(line: 5, column: 10, scope: !10)119