28 if (!
Base.getNode() || !
Other.Base.getNode())
30 if (!hasValidOffset() || !
Other.hasValidOffset())
41 if (
auto *A = dyn_cast<GlobalAddressSDNode>(
Base))
42 if (
auto *
B = dyn_cast<GlobalAddressSDNode>(
Other.Base))
43 if (A->getGlobal() ==
B->getGlobal()) {
44 Off +=
B->getOffset() - A->getOffset();
49 if (
auto *A = dyn_cast<ConstantPoolSDNode>(
Base))
50 if (
auto *
B = dyn_cast<ConstantPoolSDNode>(
Other.Base)) {
52 A->isMachineConstantPoolEntry() ==
B->isMachineConstantPoolEntry();
54 if (A->isMachineConstantPoolEntry())
55 IsMatch = A->getMachineCPVal() ==
B->getMachineCPVal();
57 IsMatch = A->getConstVal() ==
B->getConstVal();
60 Off +=
B->getOffset() - A->getOffset();
68 if (
auto *A = dyn_cast<FrameIndexSDNode>(
Base))
69 if (
auto *
B = dyn_cast<FrameIndexSDNode>(
Other.Base)) {
71 if (A->getIndex() ==
B->getIndex())
87 bool BaseIndexOffset::computeAliasing(
const SDNode *Op0,
96 if (!(BasePtr0.getBase().getNode() && BasePtr1.getBase().getNode()))
100 BasePtr0.equalBaseIndex(BasePtr1, DAG, PtrDiff)) {
111 IsAlias = !(*NumBytes0 <= PtrDiff);
119 IsAlias = !((PtrDiff + *NumBytes1) <= 0);
128 if (
auto *A = dyn_cast<FrameIndexSDNode>(BasePtr0.getBase()))
129 if (
auto *
B = dyn_cast<FrameIndexSDNode>(BasePtr1.getBase())) {
140 bool IsFI0 = isa<FrameIndexSDNode>(BasePtr0.getBase());
141 bool IsFI1 = isa<FrameIndexSDNode>(BasePtr1.getBase());
142 bool IsGV0 = isa<GlobalAddressSDNode>(BasePtr0.getBase());
143 bool IsGV1 = isa<GlobalAddressSDNode>(BasePtr1.getBase());
144 bool IsCV0 = isa<ConstantPoolSDNode>(BasePtr0.getBase());
145 bool IsCV1 = isa<ConstantPoolSDNode>(BasePtr1.getBase());
147 if ((IsFI0 || IsGV0 || IsCV0) && (IsFI1 || IsGV1 || IsCV1)) {
149 if (IsFI0 != IsFI1 || IsGV0 != IsGV1 || IsCV0 != IsCV1) {
153 if (IsGV0 && IsGV1) {
154 auto *GV0 = cast<GlobalAddressSDNode>(BasePtr0.getBase())->getGlobal();
155 auto *GV1 = cast<GlobalAddressSDNode>(BasePtr1.getBase())->getGlobal();
163 if (GV0 != GV1 && !isa<GlobalAlias>(GV0) && !isa<GlobalAlias>(GV1)) {
174 int64_t OtherBitSize, int64_t &BitOffset)
const {
184 return BitOffset + OtherBitSize <= BitSize;
201 bool IsIndexSignExt =
false;
205 if (
auto *
C = dyn_cast<ConstantSDNode>(
N->getOffset()))
206 Offset +=
C->getSExtValue();
210 if (
auto *
C = dyn_cast<ConstantSDNode>(
N->getOffset()))
211 Offset -=
C->getSExtValue();
218 switch (
Base->getOpcode()) {
221 if (
auto *
C = dyn_cast<ConstantSDNode>(
Base->getOperand(1)))
223 Offset +=
C->getSExtValue();
229 if (
auto *
C = dyn_cast<ConstantSDNode>(
Base->getOperand(1))) {
230 Offset +=
C->getSExtValue();
237 auto *LSBase = cast<LSBaseSDNode>(
Base.getNode());
238 unsigned int IndexResNo = (
Base->getOpcode() ==
ISD::LOAD) ? 1 : 0;
239 if (LSBase->isIndexed() &&
Base.getResNo() == IndexResNo)
240 if (
auto *
C = dyn_cast<ConstantSDNode>(LSBase->getOffset())) {
241 auto Off =
C->getSExtValue();
270 Index =
Base->getOperand(1);
275 Index = Index->getOperand(0);
276 IsIndexSignExt =
true;
280 if (Index->getOpcode() !=
ISD::ADD ||
281 !isa<ConstantSDNode>(Index->getOperand(1)))
284 Offset += cast<ConstantSDNode>(Index->getOperand(1))->getSExtValue();
285 Index = Index->getOperand(0);
287 Index = Index->getOperand(0);
288 IsIndexSignExt =
true;
290 IsIndexSignExt =
false;
291 Base = PotentialBase;
298 if (
const auto *LS0 = dyn_cast<LSBaseSDNode>(
N))
300 if (
const auto *LN = dyn_cast<LifetimeSDNode>(
N)) {
309 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
316 OS <<
"BaseIndexOffset base=[";
321 OS <<
"] offset=" <<
Offset;