[llvm] [SLP][REVEC] Make Instruction::Select support vector instructions. (PR #100507)

Han-Kuan Chen via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 22:58:16 PDT 2024


================
@@ -13196,6 +13207,15 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E, bool PostponedPHIs) {
           False = Builder.CreateIntCast(False, VecTy, GetOperandSignedness(2));
       }
 
+      unsigned CondNumElements = getNumElements(Cond->getType());
+      unsigned TrueNumElements = getNumElements(True->getType());
+      if (CondNumElements != TrueNumElements) {
+        // When the return type is i1 but the source is fixed vector type, we
+        // need to duplicate the condition value.
+        Cond = Builder.CreateShuffleVector(
+            Cond, createReplicatedMask(TrueNumElements / CondNumElements,
----------------
HanKuanChen wrote:

Add in getEntryCost, including comments.

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


More information about the llvm-commits mailing list