[llvm] [InstCombine] Try to fold trunc(shuffle(zext)) to just a shuffle (PR #78636)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 12:52:59 PST 2024


================
@@ -103,6 +103,13 @@ Value *InstCombinerImpl::EvaluateInDifferentType(Value *V, Type *Ty,
       }
     }
     break;
+  case Instruction::ShuffleVector: {
+    Value *Op0 = EvaluateInDifferentType(I->getOperand(0), Ty, isSigned);
+    Value *Op1 = EvaluateInDifferentType(I->getOperand(1), Ty, isSigned);
----------------
nikic wrote:

Ooops, this is not correct if the shuffle operand types are not the same as the result type. In that case we need to adjust to a different type with the same element type but different number of elements.

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


More information about the llvm-commits mailing list