[llvm] [RISCV] Eagerly optimize scalar packing for buildvector lowering (PR #156062)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 13:57:08 PDT 2025


================
@@ -4270,8 +4271,12 @@ static SDValue lowerBuildVectorViaPacking(SDValue Op, SelectionDAG &DAG,
                              ElemDL, XLenVT, A, B),
           0);
 
-    A = DAG.getNode(ISD::AND, SDLoc(A), XLenVT, A, Mask);
-    B = DAG.getNode(ISD::AND, SDLoc(B), XLenVT, B, Mask);
+    // Manually optimize away the ANDs if we can, DAGCombiner will
+    // sometimes end of perturbing codegen if we don't.
----------------
topperc wrote:


```suggestion
    // sometimes end up perturbing codegen if we don't.
```

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


More information about the llvm-commits mailing list