diff options
-rw-r--r-- | llvm/lib/Passes/PassBuilderPipelines.cpp | 2 | ||||
-rw-r--r-- | llvm/test/Instrumentation/PGOForceFunctionAttrs/basic.ll | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 3bb2ce0..90ba3b5 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -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)); diff --git a/llvm/test/Instrumentation/PGOForceFunctionAttrs/basic.ll b/llvm/test/Instrumentation/PGOForceFunctionAttrs/basic.ll index 1da0471..55bdb2f 100644 --- a/llvm/test/Instrumentation/PGOForceFunctionAttrs/basic.ll +++ b/llvm/test/Instrumentation/PGOForceFunctionAttrs/basic.ll @@ -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{{$}} @@ -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 { |