[llvm] [InstCombine] Optimistically allow multiple shufflevector uses in foldOpPhi (PR #114278)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 15 06:54:48 PST 2024


nikic wrote:

> > If we say that we consider it profitable to replace a shufflevector with a phi in general, then we shouldn't need the check on the uses for shufflevectors at all.
> 
> My assumption is that turning one Phi into multiple Phi instructions is not necessarily an improvement.
> 
> I could see this being an improvement on average, but it's hard to measure make statements about average code. Given it's not a clear improvement I am not sure I want to deal with the complaints for the regressions and rather would be more conservative...

I'd rather start with a simple implementation and then make it more complex if needed, rather than start with a complex implementation from the start "just in case".

If we really want to check all shufflevectors, I think the transform should be further separated from the existing one and simplify all the shufflevectors at once. It makes little sense to check that all of them simplify and compute the replacement values, then discard all of that and replace a single one of them, and then repeat the whole process again for the next shufflevector.

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


More information about the llvm-commits mailing list