[PATCH] D63626: [clang][NewPM] Remove exception handling before loading pgo sample profile data

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 21 11:42:02 PDT 2019


leonardchan added a comment.

In D63626#1553054 <https://reviews.llvm.org/D63626#1553054>, @chandlerc wrote:

> See inline comment, but I think we should just drop the testing of the function attribute bit here rather than adjusting the pipeline.


Ok. Removed the pipeline change for now.

In D63626#1553646 <https://reviews.llvm.org/D63626#1553646>, @davidxl wrote:

> Is there a bug reference somewhere?


No bug has been filed for this, but I'm not sure if this is a bug if there aren't really any issues with PGO under the new PM.



================
Comment at: llvm/lib/Passes/PassBuilder.cpp:665-668
+    // We must also remove exception handling before attaching sample profile
+    // data.
+    MPM.addPass(
+        createModuleToPostOrderCGSCCPassAdaptor(PostOrderFunctionAttrsPass()));
----------------
tejohnson wrote:
> chandlerc wrote:
> > Does the this need to go before the EarlyFPM as well as before the sample profile loader?
> > 
> > Also, this is ... a pretty expensive thing to do... Do we really need this? We've been using ThinLTO and sample PGO with the new PM for a long time and haven't seen any real issue. I think we can probably just leave this difference between the two pass managers and remove the test for this pass running rather than adding it.
> > 
> > CC-ing some others just to double check, but I'm not aware of any issues we've seen with PGO that were because of this discrepancy.
> We don't tend to use exception handling so might not be hitting the issue described in the headline.
> 
> If this is fixing an issue with SamplePGO and EH cleanup interactions, can you add a test that tests for that (i.e. is there a code optimization issue currently?).
I'm not entirely familiar with the expected codegen for SamplePGO or PruneEH and don't really know if not adding these 2 passes breaks anything.

Under the legacy PM, exception handling was removed via `PruneEH` before creating the sample profile loader, so this change was meant to match the behavior since `function-attrs` and `function(simplify-cfg)` (the new PM equivalent for `-prune-eh`) did not initially run before `SampleProfileLoaderPass` was added to the pipeline.

The original patch that added `CodeGen/pgo-sample.c` (D21197) doesn't seem to have any codegen tests either and only checks that PruneEH runs before sample profile loader creation, so I'm also unsure of what code optimizations are meant to happen.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63626





More information about the cfe-commits mailing list