Home | History | Annotate | Download | only in Scalar

Lines Matching refs:Loads

1 //===- LoadCombine.cpp - Combine Adjacent Loads ---------------------------===//
10 /// This transformation combines adjacent loads.
32 STATISTIC(NumLoadsAnalyzed, "Number of loads analyzed for combining");
33 STATISTIC(NumLoadsCombined, "Number of loads combined");
115 for (auto &Loads : LoadMap) {
116 if (Loads.second.size() < 2)
118 std::sort(Loads.second.begin(), Loads.second.end(),
122 if (aggregateLoads(Loads.second))
128 /// \brief Try to aggregate loads from a sorted list of loads to be combined.
130 /// It is guaranteed that no writes occur between any of the loads. All loads
131 /// have the same base pointer. There are at least two loads.
132 bool LoadCombine::aggregateLoads(SmallVectorImpl<LoadPOPPair> &Loads) {
133 assert(Loads.size() >= 2 && "Insufficient loads!");
139 for (auto &L : Loads) {
171 bool LoadCombine::combineLoads(SmallVectorImpl<LoadPOPPair> &Loads) {
172 // Remove loads from the end while the size is not a power of 2.
174 for (const auto &L : Loads)
177 TotalSize -= Loads.pop_back_val().Load->getType()->getPrimitiveSizeInBits();
178 if (Loads.size() < 2)
182 dbgs() << "***** Combining Loads ******\n";
183 for (const auto &L : Loads) {
191 for (const auto &L : Loads)
200 Builder->CreatePointerCast(Loads[0].POP.Pointer,
202 Loads[0].POP.Offset);
207 Twine(Loads[0].Load->getName()) + ".combined", false,
208 Loads[0].Load->getAlignment(), FirstLP.Load);
210 for (const auto &L : Loads) {
214 L.POP.Offset - Loads[0].POP.Offset, "combine.extract");
218 NumLoadsCombined = NumLoadsCombined + Loads.size();
267 INITIALIZE_PASS(LoadCombine, "load-combine", "Combine Adjacent Loads", false,