This is an archive of the discontinued LLVM Phabricator instance.

Add sample PGO support to ThinLTO new pass manager.
ClosedPublic

Authored by danielcdh on Jun 30 2017, 10:02 AM.

Details

Summary

For SamplePGO + ThinLTO, because profile annotation is done twice at both PrepareForThinLTO pipeline and backend compiler, the following changes are needed at the PrepareForThinLTO phase to ensure the IR is not changed dramatically. Otherwise the profile annotation will be inaccurate in the backend compiler.

  • disable hot-caller heuristic
  • disable loop unrolling
  • disable indirect call promotion

This will unblock the new PM testing for sample PGO (tools/clang/test/CodeGen/pgo-sample-thinlto-summary.c), which will be covered in another cfe patch.

Event Timeline

danielcdh created this revision.Jun 30 2017, 10:02 AM
tejohnson edited edge metadata.Jun 30 2017, 10:08 AM

This looks fine to me. One minor suggestion below.

lib/Passes/PassBuilder.cpp
763–764

Suggest prefixing the new bool parameter with "/*PrepareForThinLTO=*/" to make it more obvious.

danielcdh marked an inline comment as done.

address Teresa's comments.

tejohnson accepted this revision.Jul 6 2017, 1:21 PM

Sorry, thought I already had done this. LGTM

This revision is now accepted and ready to land.Jul 6 2017, 1:21 PM

Thanks Teresa.

I'll hold this and https://reviews.llvm.org/D34896 until tomorrow (Friday) morning in case Chandler/David has further comments.

danielcdh closed this revision.Jul 7 2017, 1:53 PM