Skip to content

[memprof] YAMLify one test (NFC) #119955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,89 @@
;; Avoid failures on big-endian systems that can't read the profile properly
; REQUIRES: x86_64-linux

;; TODO: Use text profile inputs once that is available for memprof.
;; This test uses the same raw profile used for memprof.ll, see instructions
;; in that file for updating.
;; Generate the profile and the IR.
; RUN: split-file %s %t

;; Generate indexed profile
; RUN: llvm-profdata merge %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdata
; RUN: llvm-profdata merge %t/memprof_match_hot_cold_new_calls.yaml -o %t.memprofdata

;; By default we should not match profile on to manually hinted operator
;; new calls, because we don't currently override the manual hints anyway.
; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdata>' -S 2>&1 | FileCheck %s --implicit-check-not !memprof --implicit-check-not !callsite
; RUN: opt < %t/memprof_match_hot_cold_new_calls.ll -passes='memprof-use<profile-filename=%t.memprofdata>' -S 2>&1 | FileCheck %s --implicit-check-not !memprof --implicit-check-not !callsite

;; Check that we match profiles onto these manually hinted new calls
;; under the -memprof-match-hot-cold-new=true option.
; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdata>' -S -memprof-match-hot-cold-new=true 2>&1 | FileCheck %s --check-prefixes=MEMPROF
; RUN: opt < %t/memprof_match_hot_cold_new_calls.ll -passes='memprof-use<profile-filename=%t.memprofdata>' -S -memprof-match-hot-cold-new=true 2>&1 | FileCheck %s --check-prefixes=MEMPROF

;--- memprof_match_hot_cold_new_calls.yaml
---
HeapProfileRecords:
- GUID: _Z3foov
AllocSites:
- Callstack:
- { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: main, LineOffset: 6, Column: 13, IsInlineFrame: false }
MemInfoBlock:
AllocCount: 1
TotalSize: 10
TotalLifetime: 0
TotalLifetimeAccessDensity: 20000
- Callstack:
- { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: main, LineOffset: 7, Column: 13, IsInlineFrame: false }
MemInfoBlock:
AllocCount: 1
TotalSize: 10
TotalLifetime: 200000
TotalLifetimeAccessDensity: 0
- Callstack:
- { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: _Z4foo2v, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: _Z3barv, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: main, LineOffset: 8, Column: 13, IsInlineFrame: false }
MemInfoBlock:
AllocCount: 1
TotalSize: 10
TotalLifetime: 200000
TotalLifetimeAccessDensity: 0
- Callstack:
- { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: _Z4foo2v, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: _Z3bazv, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: main, LineOffset: 9, Column: 13, IsInlineFrame: false }
MemInfoBlock:
AllocCount: 1
TotalSize: 10
TotalLifetime: 200000
TotalLifetimeAccessDensity: 0
- Callstack:
- { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: _Z7recursej, LineOffset: 2, Column: 12, IsInlineFrame: false }
- { Function: _Z7recursej, LineOffset: 3, Column: 10, IsInlineFrame: false }
- { Function: _Z7recursej, LineOffset: 3, Column: 10, IsInlineFrame: false }
- { Function: _Z7recursej, LineOffset: 3, Column: 10, IsInlineFrame: false }
- { Function: main, LineOffset: 31, Column: 15, IsInlineFrame: false }
MemInfoBlock:
AllocCount: 1
TotalSize: 10
TotalLifetime: 200000
TotalLifetimeAccessDensity: 0
- Callstack:
- { Function: _Z3foov, LineOffset: 1, Column: 10, IsInlineFrame: false }
- { Function: _Z7recursej, LineOffset: 2, Column: 12, IsInlineFrame: false }
- { Function: _Z7recursej, LineOffset: 3, Column: 10, IsInlineFrame: false }
- { Function: _Z7recursej, LineOffset: 3, Column: 10, IsInlineFrame: false }
- { Function: _Z7recursej, LineOffset: 3, Column: 10, IsInlineFrame: false }
- { Function: _Z7recursej, LineOffset: 3, Column: 10, IsInlineFrame: false }
- { Function: main, LineOffset: 31, Column: 15, IsInlineFrame: false }
MemInfoBlock:
AllocCount: 1
TotalSize: 10
TotalLifetime: 0
TotalLifetimeAccessDensity: 20000
CallSites: []
...
;--- memprof_match_hot_cold_new_calls.ll
; ModuleID = 'memprof_match_hot_cold_new_calls.cc'
source_filename = "memprof_match_hot_cold_new_calls.cc"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
Expand Down
Loading