Skip to content

Commit 1782d27

Browse files
authored
[LoongArch] Fix for VLDREPL node validation (#168993)
1 parent e6f2fbb commit 1782d27

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,11 +2886,13 @@ static SDValue lowerBUILD_VECTORAsBroadCastLoad(BuildVectorSDNode *BVOp,
28862886

28872887
if ((ExtType == ISD::EXTLOAD || ExtType == ISD::NON_EXTLOAD) &&
28882888
VT.getScalarSizeInBits() == LN->getMemoryVT().getScalarSizeInBits()) {
2889-
SDVTList Tys =
2890-
LN->isIndexed()
2891-
? DAG.getVTList(VT, LN->getBasePtr().getValueType(), MVT::Other)
2892-
: DAG.getVTList(VT, MVT::Other);
2893-
SDValue Ops[] = {LN->getChain(), LN->getBasePtr(), LN->getOffset()};
2889+
// Indexed loads and stores are not supported on LoongArch.
2890+
assert(LN->isUnindexed() && "Unexpected indexed load.");
2891+
2892+
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
2893+
// The offset operand of unindexed load is always undefined, so there is
2894+
// no need to pass it to VLDREPL.
2895+
SDValue Ops[] = {LN->getChain(), LN->getBasePtr()};
28942896
SDValue BCast = DAG.getNode(LoongArchISD::VLDREPL, DL, Tys, Ops);
28952897
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), BCast.getValue(1));
28962898
return BCast;

llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,3 @@ LoongArchSelectionDAGInfo::LoongArchSelectionDAGInfo()
1717
: SelectionDAGGenTargetInfo(LoongArchGenSDNodeInfo) {}
1818

1919
LoongArchSelectionDAGInfo::~LoongArchSelectionDAGInfo() = default;
20-
21-
void LoongArchSelectionDAGInfo::verifyTargetNode(const SelectionDAG &DAG,
22-
const SDNode *N) const {
23-
switch (N->getOpcode()) {
24-
case LoongArchISD::VLDREPL:
25-
// invalid number of operands; expected 2, got 3
26-
return;
27-
}
28-
SelectionDAGGenTargetInfo::verifyTargetNode(DAG, N);
29-
}

llvm/lib/Target/LoongArch/LoongArchSelectionDAGInfo.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ class LoongArchSelectionDAGInfo : public SelectionDAGGenTargetInfo {
2121
LoongArchSelectionDAGInfo();
2222

2323
~LoongArchSelectionDAGInfo() override;
24-
25-
void verifyTargetNode(const SelectionDAG &DAG,
26-
const SDNode *N) const override;
2724
};
2825

2926
} // namespace llvm

0 commit comments

Comments
 (0)