[PATCH] D131287: Fix branch weight in FoldCondBranchOnValueKnownInPredecessor pass in SimplifyCFG
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 29 01:38:03 PDT 2022
nikic resigned from this revision.
nikic added a comment.
Regarding the duplication between JumpThreading and SimplifyCFG, this basically comes down to phase ordering. SimplifyCFG is run many times throughout the pipeline, while passes like JumpThreading run only once. For that reason, SimplifyCFG often implements some basic version of optimizations that have a more powerful implementation in a dedicated pass.
Regarding BFI/BPI, I don't think we want to use those in SimplifyCFG. I don't think we can reasonably preserve BFI though all SimplifyCFG transforms -- and I believe it also depends on DT and LI, which we don't want to have as SimplifyCFG dependencies at this time.
When I mentioned updateBlockFreqAndEdgeWeight() that was more as a pointer to code that should be doing something similar -- if it uses BFI, then we indeed shouldn't reuse it directly (but maybe there is some useful logic that can be shared -- I don't know). It is a bit odd that your code seems to be substantially more complicated than what JumpThreading does.
Anyway, I'm not really familiar with branch weight metadata, so these were really just some drive-by notes, someone who is familiar should review this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131287/new/
https://reviews.llvm.org/D131287
More information about the llvm-commits
mailing list