[llvm] [SimplifyCFG] Preserve common TBAA metadata when hoisting instructions. (PR #97158)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 03:43:15 PST 2024


fhahn wrote:

> > Thanks, updated this PR to relax `EqTermsOnly` to allow hoisting for equivalent instructions. Could also limit to cases with 2 successors, similarly to `FoldTwoEntryPHINode`. Is that along the lines you had in mind?
> 
> Not really. What I had in mind is that we only allow early hoisting if it actually ends up deduplicating the blocks entirely, i.e. we either hoist everything including the terminators, or nothing. That seems in the spirit of what the EqTermsOnly condition was doing previously.
> 
> If you only allow hoisting identical instructions, then I think that's not really materially different from just allowing _all_ hoisting. I think the only thing that would disable is the more sophisticated heuristics for finding those identical instructions?

Right, I update the code to check that the terminators in the successors match and the # of instructions is the same to ensure to only hoist if all instructions match

https://github.com/llvm/llvm-project/pull/97158


More information about the llvm-commits mailing list