summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2019-02-05 07:36:20 +0000
committerClement Courbet <courbet@google.com>2019-02-05 07:36:20 +0000
commit17b51b655e3afb4f6dd24a5ac1859bcece07777b (patch)
treeb9eed6705a0d45533d4720a9c08684b57674c3a3
parent879a45633ddf718716cb8ae820fe85254b070b1d (diff)
downloadbcm5719-llvm-17b51b655e3afb4f6dd24a5ac1859bcece07777b.tar.gz
bcm5719-llvm-17b51b655e3afb4f6dd24a5ac1859bcece07777b.zip
[DAG] BaseIndexOffset: FrameIndexSDNodes with the same FrameIndex compare equal.
Reviewers: niravd Subscribers: arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57692 llvm-svn: 353143
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
index e57dabca5ee..5666c1293e9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
@@ -59,17 +59,22 @@ bool BaseIndexOffset::equalBaseIndex(const BaseIndexOffset &Other,
const MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
- // Match non-equal FrameIndexes - If both frame indices are fixed
- // we know their relative offsets and can compare them. Otherwise
- // we must be conservative.
+ // Match FrameIndexes.
if (auto *A = dyn_cast<FrameIndexSDNode>(Base))
- if (auto *B = dyn_cast<FrameIndexSDNode>(Other.Base))
+ if (auto *B = dyn_cast<FrameIndexSDNode>(Other.Base)) {
+ // Equal FrameIndexes - offsets are directly comparable.
+ if (A->getIndex() == B->getIndex())
+ return true;
+ // Non-equal FrameIndexes - If both frame indices are fixed
+ // we know their relative offsets and can compare them. Otherwise
+ // we must be conservative.
if (MFI.isFixedObjectIndex(A->getIndex()) &&
MFI.isFixedObjectIndex(B->getIndex())) {
Off += MFI.getObjectOffset(B->getIndex()) -
MFI.getObjectOffset(A->getIndex());
return true;
}
+ }
}
return false;
}
@@ -195,4 +200,3 @@ void BaseIndexOffset::print(raw_ostream& OS) const {
}
#endif
-
OpenPOWER on IntegriCloud