[llvm] [LoongArch] Lower build_vector to broadcast load if possible (PR #135896)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 18 18:24:38 PDT 2025
================
@@ -1876,6 +1876,51 @@ static bool isConstantOrUndefBUILD_VECTOR(const BuildVectorSDNode *Op) {
return false;
}
+// Lower BUILD_VECTOR as broadcast load (if possible).
+// For example:
+// %a = load i8, ptr %ptr
+// %b = build_vector %a, %a, %a, %a
+// is lowered to :
+// (VLDREPL_B $a0, 0)
+static SDValue lowerBUILD_VECTORAsBroadCastLoad(BuildVectorSDNode *BVOp,
+ const SDLoc &DL,
+ SelectionDAG &DAG) {
+ MVT VT = BVOp->getSimpleValueType(0);
+ int NumOps = BVOp->getNumOperands();
+
+ assert((VT.is128BitVector() || VT.is256BitVector() || VT.is512BitVector()) &&
----------------
heiher wrote:
Just wondering if `is512BitVector()` is actually needed here?
https://github.com/llvm/llvm-project/pull/135896
More information about the llvm-commits
mailing list