[pgo] Sampling PGO does not require benchmark property
Test: build with Sampling PGO Bug: 79161490 Change-Id: I70bb8dc2e4492d6a3713ca16fcb3f1216615f8ac
This commit is contained in:
parent
0bcda81dd5
commit
84803c50a6
1 changed files with 7 additions and 5 deletions
12
cc/pgo.go
12
cc/pgo.go
|
@ -199,8 +199,8 @@ func (props *PgoProperties) isPGO(ctx BaseModuleContext) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// If at least one property exists, validate that all properties exist
|
||||
if !profileKindPresent || !filePresent || !benchmarksPresent {
|
||||
// profileKindPresent and filePresent are mandatory properties.
|
||||
if !profileKindPresent || !filePresent {
|
||||
var missing []string
|
||||
if !profileKindPresent {
|
||||
missing = append(missing, "profile kind (either \"instrumentation\" or \"sampling\" property)")
|
||||
|
@ -208,13 +208,15 @@ func (props *PgoProperties) isPGO(ctx BaseModuleContext) bool {
|
|||
if !filePresent {
|
||||
missing = append(missing, "profile_file property")
|
||||
}
|
||||
if !benchmarksPresent {
|
||||
missing = append(missing, "non-empty benchmarks property")
|
||||
}
|
||||
missingProps := strings.Join(missing, ", ")
|
||||
ctx.ModuleErrorf("PGO specification is missing properties: " + missingProps)
|
||||
}
|
||||
|
||||
// Benchmark property is mandatory for instrumentation PGO.
|
||||
if isInstrumentation && !benchmarksPresent {
|
||||
ctx.ModuleErrorf("Instrumentation PGO specification is missing benchmark property")
|
||||
}
|
||||
|
||||
if isSampling && isInstrumentation {
|
||||
ctx.PropertyErrorf("pgo", "Exactly one of \"instrumentation\" and \"sampling\" properties must be set")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue