This change will enhance InstCombine to sink more instructions.
Currently, only single-use instructions are sinking, and this
change will allow multiple uses to sink as well.
Details
- Reviewers
- None
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
The test files below should be modified manually.
Transforms/LoopVectorize/first-order-recurrence.ll Transforms/LoopVectorize/float-induction.ll Transforms/InstCombine/intptr7.ll
I will remove the WIP after modifying these files.
Thanks for trying, but yikes.
Like i expected, this has a pretty interesting effect on the compile time:
https://llvm-compile-time-tracker.com/compare.php?from=ad28ff71647503c0a93f8b23a04844484f26f52b&to=c159423d2c3146b4c00fd00bd0d64ce802a74e03&stat=instructions
While i do expect this could be improved somewhat (1. pass instruction's current BB into findCommonDominator() and stop looping once CommonDom becomes that 2. ???),
i do think it's unresolvable in general, because why do we even perform this sinking in instcombine in the first place, does it allow some further instcombine folds?
We'll re-perform the same sinking each time we visit each instruction, that's a lot. If we'd just did it once, it would basically compile-time free.
Just thinking out loud.
Do we have to sink instruction in InstCombine?
Since InstCombine visits many instructions, it would be good to sink instructions outside of InstCombine.
Creating passes such as InstSink and calling them only once may also be a solution. How do you think?