[PATCH] D112129: [FuncSpec] Enable it only with -O3

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 4 02:35:00 PDT 2021


SjoerdMeijer added inline comments.


================
Comment at: llvm/lib/Passes/PassBuilderPipelines.cpp:1402
 
-    if (EnableFunctionSpecialization)
+    if (EnableFunctionSpecialization && Level.getSpeedupLevel() > 2)
       MPM.addPass(FunctionSpecializationPass());
----------------
aeubanks wrote:
> SjoerdMeijer wrote:
> > ChuanqiXu wrote:
> > > Do we need to consider SizeLevel here?
> > I think this is fine as it is, because if the Speed level is 3, we know we are not optimising for size:
> > 
> > https://github.com/llvm/llvm-project/blob/a3c05982ac05637a8f40207db83c04a1710033d5/llvm/include/llvm/Passes/OptimizationLevel.h#L32
> isn't this the same as ` && Level == OptimizationLevel::O3`? any reason why the two checks are slightly different? I think `== OptimizationLevel::O3` is a bit more consistent with the other code nearby.
Oh yes, agreed. This was not very intentional, a copy-paste from another place. I will change/fix this before committing. Thanks for spotting this and reviewing. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112129/new/

https://reviews.llvm.org/D112129



More information about the llvm-commits mailing list