[llvm] [LoongArch] Fix broadcast load with extension. (PR #155960)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 22:58:54 PDT 2025


================
@@ -2471,8 +2471,10 @@ static SDValue lowerBUILD_VECTORAsBroadCastLoad(BuildVectorSDNode *BVOp,
   if (!IdentitySrc || !BVOp->isOnlyUserOf(IdentitySrc.getNode()))
     return SDValue();
 
-  if (IsIdeneity) {
-    auto *LN = cast<LoadSDNode>(IdentitySrc);
+  auto *LN = cast<LoadSDNode>(IdentitySrc);
+  auto ExtType = LN->getExtensionType();
+
+  if (IsIdeneity && (ExtType == ISD::EXTLOAD || ExtType == ISD::NON_EXTLOAD)) {
----------------
heiher wrote:

Do you think it makes sense to precisely match the sizes of `VT.getVectorElementVT()` and `LN->getMemoryVT()`?

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


More information about the llvm-commits mailing list