[llvm] r309698 - [DAG] Move extload check in store merge. NFC.

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 09:00:47 PDT 2017


Author: niravd
Date: Tue Aug  1 09:00:47 2017
New Revision: 309698

URL: http://llvm.org/viewvc/llvm-project?rev=309698&view=rev
Log:
[DAG] Move extload check in store merge. NFC.

Move candidate check from later check to initial candidate check.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=309698&r1=309697&r2=309698&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Aug  1 09:00:47 2017
@@ -12569,7 +12569,6 @@ void DAGCombiner::getStoreMergeCandidate
   if (IsLoadSrc)
     LBasePtr = BaseIndexOffset::match(
         cast<LoadSDNode>(St->getValue())->getBasePtr(), DAG);
-
   auto CandidateMatch = [&](StoreSDNode *Other, BaseIndexOffset &Ptr,
                             int64_t &Offset) -> bool {
     if (Other->isVolatile() || Other->isIndexed())
@@ -12583,6 +12582,9 @@ void DAGCombiner::getStoreMergeCandidate
       // The Load's Base Ptr must also match
       if (LoadSDNode *OtherLd = dyn_cast<LoadSDNode>(Other->getValue())) {
         auto LPtr = BaseIndexOffset::match(OtherLd->getBasePtr(), DAG);
+        // We do not handle extended loads
+        if (OtherLd->getExtensionType() != ISD::NON_EXTLOAD)
+          return false;
         if (!(LBasePtr.equalBaseIndex(LPtr, DAG)))
           return false;
       } else
@@ -12938,10 +12940,6 @@ bool DAGCombiner::MergeConsecutiveStores
       if (Ld->isVolatile() || Ld->isIndexed())
         break;
 
-      // We do not accept ext loads.
-      if (Ld->getExtensionType() != ISD::NON_EXTLOAD)
-        break;
-
       // The stored memory type must be the same.
       if (Ld->getMemoryVT() != MemVT)
         break;




More information about the llvm-commits mailing list