[llvm] [InstCombine] Do not fold `shufflevector(select)` if the select condition is a vector (PR #113993)
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 19:12:16 PDT 2024
================
@@ -2902,8 +2902,12 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
if (match(RHS, m_Constant())) {
if (auto *SI = dyn_cast<SelectInst>(LHS)) {
- if (Instruction *I = FoldOpIntoSelect(SVI, SI))
- return I;
+ // We cannot do this fold for elementwise select since ShuffleVector is
+ // not elementwise.
+ if (SI->getCondition()->getType()->isIntegerTy()) {
+ if (Instruction *I = FoldOpIntoSelect(SVI, SI))
+ return I;
+ }
----------------
MatzeB wrote:
I think we could still perform this transformation when the shuffle operand types are the same as the shuffle output types? Regardless it is probably best to just land this change as quick as possible to unbreak things. I can look into re-enabling it for same-type myself then.
https://github.com/llvm/llvm-project/pull/113993
More information about the llvm-commits
mailing list