1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[SDAG] Improve MemSDNode::getBasePtr

It returned getOperand(1), except for STORE for which it returned
getOperand(2). Handle MSTORE, MGATHER, and MSCATTER as well.
This commit is contained in:
Krzysztof Parzyszek 2020-08-24 13:25:06 -05:00
parent 47e8ccf0a3
commit d984833f21

View File

@ -1379,8 +1379,18 @@ public:
}
const SDValue &getChain() const { return getOperand(0); }
const SDValue &getBasePtr() const {
return getOperand(getOpcode() == ISD::STORE ? 2 : 1);
switch (getOpcode()) {
case ISD::STORE:
case ISD::MSTORE:
return getOperand(2);
case ISD::MGATHER:
case ISD::MSCATTER:
return getOperand(3);
default:
return getOperand(1);
}
}
// Methods to support isa and dyn_cast
@ -2292,9 +2302,6 @@ public:
// MaskedLoadSDNode (Chain, ptr, offset, mask, passthru)
// MaskedStoreSDNode (Chain, data, ptr, offset, mask)
// Mask is a vector of i1 elements
const SDValue &getBasePtr() const {
return getOperand(getOpcode() == ISD::MLOAD ? 1 : 2);
}
const SDValue &getOffset() const {
return getOperand(getOpcode() == ISD::MLOAD ? 2 : 3);
}