[PATCH] D57692: [DAG] BaseIndexOffset: FrameIndexSDNodes with the same FrameIndex compare equal.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 4 23:36:23 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL353143: [DAG] BaseIndexOffset: FrameIndexSDNodes with the same FrameIndex compare equal. (authored by courbet, committed by ).

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57692/new/

https://reviews.llvm.org/D57692

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


Index: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
@@ -59,17 +59,22 @@
 
     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 @@
 }
 
 #endif
-


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57692.185245.patch
Type: text/x-patch
Size: 1404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190205/4464e5bb/attachment.bin>


More information about the llvm-commits mailing list