In some compiler passes like SampleProfileLoaderPass, we want to know which LTO/ThinLTO phase the pass is in. Currently the phase is represented in enum class PassBuilder::ThinLTOPhase, so it is only available in PassBuilder and it also cannot represent phase in full LTO. The patch extends it to include LTO phases and move it from PassBuilder.h to Pass.h, then it is much easier for PassBuilder to communiate with each pass about current LTO phase.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for refactoring. We had internal change to add IsFullLTOPreLink alongside with IsThinLTOPreLink for a few places. And we always wanted clean it up too. :)
llvm/include/llvm/Pass.h | ||
---|---|---|
75 | nit: name it LTOPhase? There's similar change in https://reviews.llvm.org/D69732. And perhaps FullLTOPreLink and FullLTOPostLink too though I noticed there's PrepareForLTO and PrepareForThinLTO.. Not sure if LTO is always used to refer FullLTO.. |
llvm/include/llvm/Pass.h | ||
---|---|---|
75 | LTO traditionally refers to FullLTO, so using LTO can be confusing. I suggest make it even clearer: ThinOrFullLTOPhase |
llvm/include/llvm/Pass.h | ||
---|---|---|
75 | Thanks, I use ThinOrFullLTOPhase for the enum class name and change LTOPreLink/LTOPostLink to FullLTOPreLink/FullLTOPostLink. |
Thanks for the refactoring!
BTW, looks like there is a use of ThinLTOPhase::None to be replaced in polly/lib/Support/RegisterPasses.cpp. Otherwise, LGTM.
nit: name it LTOPhase? There's similar change in https://reviews.llvm.org/D69732.
And perhaps FullLTOPreLink and FullLTOPostLink too though I noticed there's PrepareForLTO and PrepareForThinLTO.. Not sure if LTO is always used to refer FullLTO..