Skip to content

[AsmPrint] Dump raw frequencies in -mbb-profile-dump #66818

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
Sep 19, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,7 @@ void AsmPrinter::emitFunctionBody() {
for (const auto &MBB : *MF) {
*MBBProfileDumpFileOutput.get()
<< MF->getName() << "," << MBB.getBBID() << ","
<< MBFI.getBlockFreqRelativeToEntryBlock(&MBB) << "\n";
<< MBFI.getBlockFreq(&MBB).getFrequency() << "\n";
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions llvm/test/CodeGen/MLRegAlloc/bb-profile-dump.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ define i64 @f2(i64 %a, i64 %b) {
ret i64 %sum
}

; CHECK: f2,0,8

define i64 @f1() {
%sum = call i64 @f2(i64 2, i64 2)
%isEqual = icmp eq i64 %sum, 4
Expand All @@ -22,10 +24,9 @@ ifNotEqual:
ret i64 %sum
}

; CHECK: f2,0,1.000000e+00
; CHECK-NEXT: f1,0,1.000000e+00
; CHECK-NEXT: f1,1,5.000000e-01
; CHECK-NEXT: f1,2,1.000000e+00
; CHECK-NEXT: f1,0,16
; CHECK-NEXT: f1,1,8
; CHECK-NEXT: f1,2,16

; Check that if we pass -mbb-profile-dump but don't set -basic-block-sections,
; we get an appropriate error message
Expand Down