[llvm] r307055 - [DAG] Fixed predicate for determining when two frame indices

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 3 19:20:17 PDT 2017


Author: niravd
Date: Mon Jul  3 19:20:17 2017
New Revision: 307055

URL: http://llvm.org/viewvc/llvm-project?rev=307055&view=rev
Log:
[DAG] Fixed predicate for determining when two frame indices
addresses are comparable. NFCI.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp?rev=307055&r1=307054&r2=307055&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp Mon Jul  3 19:20:17 2017
@@ -37,13 +37,13 @@ bool BaseIndexOffset::equalBaseIndex(Bas
 
     const MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
 
-    // Match non-equal FrameIndexes - a FrameIndex stemming from an
-    // alloca will not have it's ObjectOffset set until post-DAG and
-    // as such we must assume the two framesIndices are incomparable.
+    // Match non-equal FrameIndexes - If both frame indices are fixed
+    // we know their relative offsets and can compare them. Otherwise
+    // we must be conservative.
     if (auto *A = dyn_cast<FrameIndexSDNode>(Base))
       if (auto *B = dyn_cast<FrameIndexSDNode>(Other.Base))
-        if (!MFI.getObjectAllocation(A->getIndex()) &&
-            !MFI.getObjectAllocation(B->getIndex())) {
+        if (MFI.isFixedObjectIndex(A->getIndex()) &&
+            MFI.isFixedObjectIndex(B->getIndex())) {
           Off += MFI.getObjectOffset(B->getIndex()) -
                  MFI.getObjectOffset(A->getIndex());
           return true;




More information about the llvm-commits mailing list