[llvm] r305527 - Revert "[DAG] Allow truncated and extend memory operations in Store Merge. NFCI."

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 16:29:47 PDT 2017


Author: ab
Date: Thu Jun 15 18:29:47 2017
New Revision: 305527

URL: http://llvm.org/viewvc/llvm-project?rev=305527&view=rev
Log:
Revert "[DAG] Allow truncated and extend memory operations in Store Merge. NFCI."

This reverts commit r305468, as it caused PR33475.

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=305527&r1=305526&r2=305527&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Jun 15 18:29:47 2017
@@ -12873,6 +12873,9 @@ 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)
@@ -13009,31 +13012,17 @@ bool DAGCombiner::MergeConsecutiveStores
 
     // The merged loads are required to have the same incoming chain, so
     // using the first's chain is acceptable.
+    SDValue NewLoad = DAG.getLoad(JointMemOpVT, LoadDL, FirstLoad->getChain(),
+                                  FirstLoad->getBasePtr(),
+                                  FirstLoad->getPointerInfo(), FirstLoadAlign);
 
     SDValue NewStoreChain = getMergeStoreChains(StoreNodes, NumElem);
+
     AddToWorklist(NewStoreChain.getNode());
 
-    SDValue NewLoad, NewStore;
-    if (TLI.isTypeLegal(JointMemOpVT)) {
-      NewLoad = DAG.getLoad(JointMemOpVT, LoadDL, FirstLoad->getChain(),
-                            FirstLoad->getBasePtr(),
-                            FirstLoad->getPointerInfo(), FirstLoadAlign);
-      NewStore = DAG.getStore(NewStoreChain, StoreDL, NewLoad,
-                              FirstInChain->getBasePtr(),
-                              FirstInChain->getPointerInfo(), FirstStoreAlign);
-    } else { // This must be the truncstore/extload case
-      EVT ExtendedTy =
-          TLI.getTypeToTransformTo(*DAG.getContext(), JointMemOpVT);
-      NewLoad = DAG.getExtLoad(ISD::EXTLOAD, LoadDL, ExtendedTy,
-                               FirstLoad->getChain(), FirstLoad->getBasePtr(),
-                               FirstLoad->getPointerInfo(), JointMemOpVT,
-                               FirstLoadAlign);
-      NewStore = DAG.getTruncStore(NewStoreChain, StoreDL, NewLoad,
-                                   FirstInChain->getBasePtr(),
-                                   FirstInChain->getPointerInfo(), JointMemOpVT,
-                                   FirstInChain->getAlignment(),
-                                   FirstInChain->getMemOperand()->getFlags());
-    }
+    SDValue NewStore = DAG.getStore(
+        NewStoreChain, StoreDL, NewLoad, FirstInChain->getBasePtr(),
+        FirstInChain->getPointerInfo(), FirstStoreAlign);
 
     // Transfer chain users from old loads to the new load.
     for (unsigned i = 0; i < NumElem; ++i) {




More information about the llvm-commits mailing list