OSDN Git Service

[DAG] Move extload check in store merge. NFC.
authorNirav Dave <niravd@google.com>
Tue, 1 Aug 2017 16:00:47 +0000 (16:00 +0000)
committerNirav Dave <niravd@google.com>
Tue, 1 Aug 2017 16:00:47 +0000 (16:00 +0000)
Move candidate check from later check to initial candidate check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309698 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 5c9db97..6dd9e92 100644 (file)
@@ -12569,7 +12569,6 @@ void DAGCombiner::getStoreMergeCandidates(
   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::getStoreMergeCandidates(
       // 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(StoreSDNode *St) {
       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;