[llvm] r296331 - [DAGCombine] NFC. MatchLoadCombine remember the first byte provider, not the load node

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 03:40:14 PST 2017


Author: apilipenko
Date: Mon Feb 27 05:40:14 2017
New Revision: 296331

URL: http://llvm.org/viewvc/llvm-project?rev=296331&view=rev
Log:
[DAGCombine] NFC. MatchLoadCombine remember the first byte provider, not the load node

This refactoring will simplify the upcoming change to fix a bug in folding patterns with non-zero offsets on BE targets.

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=296331&r1=296330&r2=296331&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Feb 27 05:40:14 2017
@@ -4520,7 +4520,7 @@ SDValue DAGCombiner::MatchLoadCombine(SD
   SDValue Chain;
 
   SmallSet<LoadSDNode *, 8> Loads;
-  LoadSDNode *FirstLoad = nullptr;
+  Optional<ByteProvider> FirstByteProvider;
   int64_t FirstOffset = INT64_MAX;
 
   bool IsBigEndianTarget = DAG.getDataLayout().isBigEndian();
@@ -4565,7 +4565,7 @@ SDValue DAGCombiner::MatchLoadCombine(SD
 
     // Remember the first byte load
     if (ByteOffsetFromBase < FirstOffset) {
-      FirstLoad = L;
+      FirstByteProvider = P;
       FirstOffset = ByteOffsetFromBase;
     }
 
@@ -4587,7 +4587,9 @@ SDValue DAGCombiner::MatchLoadCombine(SD
       return SDValue();
   }
   assert((BigEndian != LittleEndian) && "should be either or");
-  assert(FirstLoad && "must be set");
+  assert(FirstByteProvider && "must be set");
+
+  LoadSDNode *FirstLoad = FirstByteProvider->Load;
 
   // The node we are looking at matches with the pattern, check if we can
   // replace it with a single load and bswap if needed.




More information about the llvm-commits mailing list