]> granicus.if.org Git - llvm/commitdiff
[DAGCombine] NFC. MatchLoadCombine remember the first byte provider, not the load...
authorArtur Pilipenko <apilipenko@azulsystems.com>
Mon, 27 Feb 2017 11:40:14 +0000 (11:40 +0000)
committerArtur Pilipenko <apilipenko@azulsystems.com>
Mon, 27 Feb 2017 11:40:14 +0000 (11:40 +0000)
This refactoring will simplify the upcoming change to fix a bug in folding patterns with non-zero offsets on BE targets.

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

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 39aa823359486236fa4b389d9d5044c960f03907..34be7766b575f584ec9e1eea1176916c9e9d75b8 100644 (file)
@@ -4520,7 +4520,7 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) {
   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(SDNode *N) {
 
     // Remember the first byte load
     if (ByteOffsetFromBase < FirstOffset) {
-      FirstLoad = L;
+      FirstByteProvider = P;
       FirstOffset = ByteOffsetFromBase;
     }
 
@@ -4587,7 +4587,9 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) {
       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.