diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp index 39a1e09e83c5..66825d845c19 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp @@ -38,15 +38,18 @@ bool BaseIndexOffset::equalBaseIndex(const BaseIndexOffset &Other, return true; // Match GlobalAddresses - if (auto *A = dyn_cast<GlobalAddressSDNode>(Base)) + if (auto *A = dyn_cast<GlobalAddressSDNode>(Base)) { if (auto *B = dyn_cast<GlobalAddressSDNode>(Other.Base)) if (A->getGlobal() == B->getGlobal()) { Off += B->getOffset() - A->getOffset(); return true; } + return false; + } + // Match Constants - if (auto *A = dyn_cast<ConstantPoolSDNode>(Base)) + if (auto *A = dyn_cast<ConstantPoolSDNode>(Base)) { if (auto *B = dyn_cast<ConstantPoolSDNode>(Other.Base)) { bool IsMatch = A->isMachineConstantPoolEntry() == B->isMachineConstantPoolEntry(); @@ -62,7 +65,8 @@ bool BaseIndexOffset::equalBaseIndex(const BaseIndexOffset &Other, } } - const MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo(); + return false; + } // Match FrameIndexes. if (auto *A = dyn_cast<FrameIndexSDNode>(Base)) @@ -73,6 +77,7 @@ bool BaseIndexOffset::equalBaseIndex(const BaseIndexOffset &Other, // Non-equal FrameIndexes - If both frame indices are fixed // we know their relative offsets and can compare them. Otherwise // we must be conservative. + const MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo(); if (MFI.isFixedObjectIndex(A->getIndex()) && MFI.isFixedObjectIndex(B->getIndex())) { Off += MFI.getObjectOffset(B->getIndex()) - @@ -81,6 +86,7 @@ bool BaseIndexOffset::equalBaseIndex(const BaseIndexOffset &Other, } } } + return false; } @@ -91,10 +97,13 @@ bool BaseIndexOffset::computeAliasing(const SDNode *Op0, const SelectionDAG &DAG, bool &IsAlias) { BaseIndexOffset BasePtr0 = match(Op0, DAG); - BaseIndexOffset BasePtr1 = match(Op1, DAG); + if (!BasePtr0.getBase().getNode()) + return false; - if (!(BasePtr0.getBase().getNode() && BasePtr1.getBase().getNode())) + BaseIndexOffset BasePtr1 = match(Op1, DAG); + if (!BasePtr1.getBase().getNode()) return false; + int64_t PtrDiff; if (NumBytes0 && NumBytes1 && BasePtr0.equalBaseIndex(BasePtr1, DAG, PtrDiff)) { |
