[llvm] [instcombine] Delete dead transform for rev(binop splat, rev(x)) (PR #143967)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 08:26:45 PDT 2025
preames wrote:
> > We canonicalize splats to RHS
>
> Does it still happen when BO0splat is not a constant? I cannot find related code in `InstCombinerImpl::foldVectorBinop`. BTW, the binop may not be commutative. I think it is still useful for sub/div/shl.
You're right about the canonicalization (and the commutative bit), but interestingly, it appears this code still has no effect. We have test cases (e.g. reverse_binop_reverse_splat_LHS) for exactly the cases you pointed to, and even without this bit of code, everything continues to work. We appear to have another transform which given binop splat X, rev(Y) canonicalizes this as rev(binop splat X, Y), and then a rev(rev(x)) -> X transform kills the pair of reverse.
(See foldVectorBinOp, and createBinOpReverse)
It looks like this entire case in the switch might be dead.
Unless there's some way to trigger this I'm not seeing? We don't have any test coverage which is impacted by it, is there some case we should be testing here?
https://github.com/llvm/llvm-project/pull/143967
More information about the llvm-commits
mailing list