Skip to content
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/Passes/PassBuilderPipelines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
if (EnableSyntheticCounts && !PGOOpt)
MPM.addPass(SyntheticCountsPropagation());

if (EnablePGOForceFunctionAttrs)
if (EnablePGOForceFunctionAttrs && PGOOpt)
MPM.addPass(PGOForceFunctionAttrsPass(PGOOpt->ColdOptType));

MPM.addPass(AlwaysInlinerPass(/*InsertLifetimeIntrinsics=*/true));
Expand Down
4 changes: 4 additions & 0 deletions llvm/test/Instrumentation/PGOForceFunctionAttrs/basic.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

; Should be no changes without profile data
; RUN: opt < %s -passes=pgo-force-function-attrs -S -pgo-cold-func-opt=minsize | FileCheck %s --check-prefixes=NONE,CHECK
; RUN: opt < %s -passes='default<O2>' -enable-pgo-force-function-attrs -S -pgo-cold-func-opt=minsize | FileCheck %s --check-prefixes=O2

; NONE-NOT: Function Attrs:
; OPTSIZE: Function Attrs: optsize{{$}}
Expand Down Expand Up @@ -37,6 +38,9 @@
; CHECK-NOT: Function Attrs: {{.*}}minsize
; CHECK-NOT: Function Attrs: {{.*}}optnone

; O2: define void @cold_attr(){{.*}} #[[ATTR:[0-9]+]]
; O2-NOT: #[[ATTR]] = {{.*}}minsize

@s = global i32 0

define void @cold() !prof !27 {
Expand Down