Skip to content

[PGO] Don't unconditionally request BBInfo in verifyFuncBFI() #140804

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 4 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 0 additions & 6 deletions llvm/include/llvm/Transforms/Instrumentation/CFGMST.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,6 @@ template <class Edge, class BBInfo> class CFGMST {
LLVM_DEBUG(dbgs() << " Edge: from fake node to " << Entry->getName()
<< " w = " << EntryWeight << "\n");

// Special handling for single BB functions.
if (succ_empty(Entry)) {
addEdge(Entry, nullptr, EntryWeight);
return;
}

static const uint32_t CriticalEdgeMultiplier = 1000;

for (BasicBlock &BB : F) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# IR level Instrumentation Flag
:ir
foo
# Func Hash:
742261418966908927
# Num Counters:
1
# Counter Values:
1
13 changes: 13 additions & 0 deletions llvm/test/Transforms/PGOProfile/unreachable-block.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; RUN: llvm-profdata merge %S/Inputs/unreachable-block.proftext -o %t.profdata
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s

declare ptr @bar()

; CHECK: define ptr @foo
define ptr @foo() {
entry:
ret ptr null

2:
ret ptr null
}