[PATCH] D145210: [Pipeline] Adjust PostOrderFunctionAttrs placement in simplification pipeline

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 15:03:28 PDT 2023


aeubanks added inline comments.


================
Comment at: llvm/lib/Passes/PassBuilderPipelines.cpp:838
+  // functions.
+  MainCGPipeline.addPass(PostOrderFunctionAttrsPass(/*SkipNonRecursive*/ true));
 
----------------
cfang wrote:
> aeubanks wrote:
> > cfang wrote:
> > > We found that "nofree" attribute will greatly affect the earlyCSE pass in function simplification. In our case, missing nofree essentially disabled earlyCSE which resulted in a huge performance regression (register pressure).   Other optimizations like GVN in function simplification may also be affected by function attributes.
> > > 
> > > So is it possible that we just run this pass twice?   Thanks.
> > Can you give an example where EarlyCSE depends on function attributes? That doesn't really make sense to me, function attributes should really be used by callers of the function, not the function itself.
> EarlyCSE can make use of the attributes of the functions it calls. 
> The pass manager should be running passes such that the attributes
> of callees are known before running optimizations on the callers
yes the pass manager already takes care of visiting callees before callers with the CGSCCPassManager. the only case where we need to run function-attrs before the function simplification pipeline is when you have recursive functions, which this patch handles.

so I'm still not understanding where you'd be seeing a regression


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145210



More information about the llvm-commits mailing list