Skip to content

Conversation

@zhaoqi5
Copy link
Contributor

@zhaoqi5 zhaoqi5 commented Nov 21, 2025

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Nov 21, 2025

@llvm/pr-subscribers-backend-loongarch

Author: ZhaoQi (zhaoqi5)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/168993.diff

3 Files Affected:

  • (modified) llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp (+7-5)
  • (modified) llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.cpp (-10)
  • (modified) llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.h (-3)
diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
index ac95ef5f30888..b8c1c261fa6db 100644
--- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
@@ -2886,11 +2886,13 @@ static SDValue lowerBUILD_VECTORAsBroadCastLoad(BuildVectorSDNode *BVOp,
 
   if ((ExtType == ISD::EXTLOAD || ExtType == ISD::NON_EXTLOAD) &&
       VT.getScalarSizeInBits() == LN->getMemoryVT().getScalarSizeInBits()) {
-    SDVTList Tys =
-        LN->isIndexed()
-            ? DAG.getVTList(VT, LN->getBasePtr().getValueType(), MVT::Other)
-            : DAG.getVTList(VT, MVT::Other);
-    SDValue Ops[] = {LN->getChain(), LN->getBasePtr(), LN->getOffset()};
+    // Indexed loads and stores are not supported on LoongArch.
+    assert(LN->isUnindexed() && "Unexpected indexed load.");
+
+    SDVTList Tys = DAG.getVTList(VT, MVT::Other);
+    // The offset operand of unindexed load is always undefined, so there is
+    // no need to pass it to VLDREPL.
+    SDValue Ops[] = {LN->getChain(), LN->getBasePtr()};
     SDValue BCast = DAG.getNode(LoongArchISD::VLDREPL, DL, Tys, Ops);
     DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), BCast.getValue(1));
     return BCast;
diff --git a/llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.cpp b/llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.cpp
index 11d05042c94f8..c07adfc48a0f5 100644
--- a/llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.cpp
@@ -17,13 +17,3 @@ LoongArchSelectionDAGInfo::LoongArchSelectionDAGInfo()
     : SelectionDAGGenTargetInfo(LoongArchGenSDNodeInfo) {}
 
 LoongArchSelectionDAGInfo::~LoongArchSelectionDAGInfo() = default;
-
-void LoongArchSelectionDAGInfo::verifyTargetNode(const SelectionDAG &DAG,
-                                                 const SDNode *N) const {
-  switch (N->getOpcode()) {
-  case LoongArchISD::VLDREPL:
-    // invalid number of operands; expected 2, got 3
-    return;
-  }
-  SelectionDAGGenTargetInfo::verifyTargetNode(DAG, N);
-}
diff --git a/llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.h b/llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.h
index ba5657080b3e4..7210a15297a3e 100644
--- a/llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.h
+++ b/llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.h
@@ -21,9 +21,6 @@ class LoongArchSelectionDAGInfo : public SelectionDAGGenTargetInfo {
   LoongArchSelectionDAGInfo();
 
   ~LoongArchSelectionDAGInfo() override;
-
-  void verifyTargetNode(const SelectionDAG &DAG,
-                        const SDNode *N) const override;
 };
 
 } // namespace llvm

@github-actions
Copy link

🐧 Linux x64 Test Results

  • 186427 tests passed
  • 4868 tests skipped

Copy link
Contributor

@s-barannikov s-barannikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants