[llvm] [X86][AVX] Match v4f64 blend from shuffle of scalar values. (PR #135753)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 27 03:41:18 PDT 2025


================
@@ -8753,29 +8753,28 @@ static SDValue lowerBuildVectorAsBlend(BuildVectorSDNode *BVOp, SDLoc const &DL,
   MVT VT = BVOp->getSimpleValueType(0u);
   auto const NumElems = VT.getVectorNumElements();
 
-  if (Subtarget.hasAVX() && VT == MVT::v4f64) {
+  if (VT == MVT::v4f64) {
     // Collect unique operands.
     auto UniqueOps = SmallSet<SDValue, 16u>();
-    for (auto &Op : BVOp->ops()) {
-      if (isIntOrFPConstant(Op) || Op.get()->isUndef())
-        return {};
+    for (SDValue Op : BVOp->ops()) {
+      if (isIntOrFPConstant(Op) || Op.isUndef())
+        return SDValue();
       UniqueOps.insert(Op);
     }
     // Candidate BUILD_VECTOR must have 2 unique operands.
     if (UniqueOps.size() != 2u)
-      return {};
+      return SDValue();
     // Create shuffle mask.
-    auto Op0 = BVOp->getOperand(0u);
-    auto Mask = std::vector<int>();
-    Mask.reserve(NumElems);
+    SDValue Op0 = BVOp->getOperand(0u);
----------------
RKSimon wrote:

You can't assume Op0 == *UniqueOps.begin() - the SmallSet might have reordered them

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


More information about the llvm-commits mailing list