
There is a case when branch profile metadata is OK to miss, namely, cold functions. The goal of the RFC (see the referenced issue) is to avoid accidental omission (and, at a later date, corruption) of profile metadata. However, asking cold functions to have all their conditional branches marked with "0" probabilities would be overdoing it. We can just ask cold functions to have an explicit 0 entry count. This patch: - injects an entry count for functions, unless they have one (synthetic or not) - if the entry count is 0, doesn't inject, nor does it verify the rest of the metadata - at verification, if the entry count is missing, it reports an error Issue #147390
15 lines
324 B
LLVM
15 lines
324 B
LLVM
; Test prof-verify for functions without entry count
|
|
|
|
; RUN: not opt -passes=prof-verify %s -o - 2>&1 | FileCheck %s
|
|
|
|
define void @foo(i32 %i) {
|
|
%c = icmp eq i32 %i, 0
|
|
br i1 %c, label %yes, label %no
|
|
yes:
|
|
ret void
|
|
no:
|
|
ret void
|
|
}
|
|
|
|
; CHECK: Profile verification failed: function entry count missing (set to 0 if cold)
|