diff options
| author | Nirav Dave <niravd@google.com> | 2017-12-22 16:59:09 +0000 |
|---|---|---|
| committer | Nirav Dave <niravd@google.com> | 2017-12-22 16:59:09 +0000 |
| commit | 4ce902657a9ed376fe76019a9431751cf83e6f28 (patch) | |
| tree | dd64193bd4dfa5b7e8a4542cf9aec314a49d89b0 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp | |
| parent | a966f45b7ee6a9c77a7040b51a18c01caac90918 (diff) | |
| download | bcm5719-llvm-4ce902657a9ed376fe76019a9431751cf83e6f28.tar.gz bcm5719-llvm-4ce902657a9ed376fe76019a9431751cf83e6f28.zip | |
[DAG] Integrate findBaseOffset address analyses to BaseIndexOffset. NFCI.
BaseIndexOffset supercedes findBaseOffset analysis save only Constant
Pool addresses. Migrate analysis to BaseIndexOffset.
llvm-svn: 321364
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp index 544da362be6..d5980919d03 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp @@ -37,6 +37,23 @@ bool BaseIndexOffset::equalBaseIndex(BaseIndexOffset &Other, return true; } + // Match Constants + if (auto *A = dyn_cast<ConstantPoolSDNode>(Base)) + if (auto *B = dyn_cast<ConstantPoolSDNode>(Other.Base)) { + bool IsMatch = + A->isMachineConstantPoolEntry() == B->isMachineConstantPoolEntry(); + if (IsMatch) { + if (A->isMachineConstantPoolEntry()) + IsMatch = A->getMachineCPVal() == B->getMachineCPVal(); + else + IsMatch = A->getConstVal() == B->getConstVal(); + } + if (IsMatch) { + Off += B->getOffset() - A->getOffset(); + return true; + } + } + const MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo(); // Match non-equal FrameIndexes - If both frame indices are fixed |

