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

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 1 02:12:05 PDT 2025


================
@@ -2516,11 +2516,14 @@ static SDValue lowerBUILD_VECTORAsBroadCastLoad(BuildVectorSDNode *BVOp,
   }
 
   // make sure that this load is valid and only has one user.
-  if (!IdentitySrc || !BVOp->isOnlyUserOf(IdentitySrc.getNode()))
+  if (!IsIdeneity || !IdentitySrc || !BVOp->isOnlyUserOf(IdentitySrc.getNode()))
     return SDValue();
 
-  if (IsIdeneity) {
-    auto *LN = cast<LoadSDNode>(IdentitySrc);
+  auto *LN = cast<LoadSDNode>(IdentitySrc);
+  auto ExtType = LN->getExtensionType();
+
+  if ((ExtType == ISD::EXTLOAD || ExtType == ISD::NON_EXTLOAD) &&
----------------
tangaac wrote:

The error occurs in a load with extension.
I think it's better to keep this extension type judgement.

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


More information about the llvm-commits mailing list