[llvm] [InstCombine] Do not fold `shufflevector(select)` if the select condition is a vector (PR #113993)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 19:18:28 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;
+ }
----------------
dtcxzyw wrote:
There is a counterexample: https://alive2.llvm.org/ce/z/s8saCx.
https://github.com/llvm/llvm-project/pull/113993
More information about the llvm-commits
mailing list