Deleted Added
sdiff udiff text old ( 263508 ) new ( 266715 )
full compact
1//===--- ScheduleDAGSDNodes.cpp - Implement the ScheduleDAGSDNodes class --===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 205 unchanged lines hidden (view full) ---

214
215 // Look for other loads of the same chain. Find loads that are loading from
216 // the same base pointer and different offsets.
217 SmallPtrSet<SDNode*, 16> Visited;
218 SmallVector<int64_t, 4> Offsets;
219 DenseMap<long long, SDNode*> O2SMap; // Map from offset to SDNode.
220 bool Cluster = false;
221 SDNode *Base = Node;
222 for (SDNode::use_iterator I = Chain->use_begin(), E = Chain->use_end();
223 I != E; ++I) {
224 SDNode *User = *I;
225 if (User == Node || !Visited.insert(User))
226 continue;
227 int64_t Offset1, Offset2;
228 if (!TII->areLoadsFromSameBasePtr(Base, User, Offset1, Offset2) ||
229 Offset1 == Offset2)
230 // FIXME: Should be ok if they addresses are identical. But earlier
231 // optimizations really should have eliminated one of the loads.
232 continue;
233 if (O2SMap.insert(std::make_pair(Offset1, Base)).second)
234 Offsets.push_back(Offset1);
235 O2SMap.insert(std::make_pair(Offset2, User));
236 Offsets.push_back(Offset2);
237 if (Offset2 < Offset1)
238 Base = User;
239 Cluster = true;
240 }
241
242 if (!Cluster)
243 return;
244
245 // Sort them in increasing order.
246 std::sort(Offsets.begin(), Offsets.end());
247

--- 660 unchanged lines hidden ---