@@ -386,15 +386,6 @@ std::pair<MemoryLocationRange, bool> aggregate(
386386 break ;
387387 }
388388 unsigned int TripCount = 0 ;
389- /* if (C->getLoop()->getLoopLatch() == C->getLoop()->getExitingBlock()) {
390- LLVM_DEBUG(dbgs() << "[AGGREGATE] Node kind: Latch and Exiting.\n");
391- TripCount = SE->getSmallConstantTripCount(C->getLoop());
392- } else {
393- LLVM_DEBUG(dbgs() << "[AGGREGATE] Node kind: Latch or Exiting.\n");
394- auto BTC = SE->getBackedgeTakenCount(C->getLoop());
395- if (isa<SCEVConstant>(BTC))
396- TripCount = cast<SCEVConstant>(BTC)->getAPInt().getZExtValue();
397- }*/
398389 if (C->getLoop ()->getLoopLatch () == C->getLoop ()->getExitingBlock ()) {
399390 LLVM_DEBUG (dbgs () << " [AGGREGATE] Node kind: Latch and Exiting.\n " );
400391 TripCount = SE->getSmallConstantTripCount (C->getLoop ());
@@ -525,7 +516,8 @@ std::pair<MemoryLocationRange, bool> aggregate(
525516 getSExtValue () >= DimInfo.DimSize && DimensionN != 0 && N != nullptr ) {
526517 auto End = cast<SCEVConstant>(DimInfo.End )->getAPInt ().
527518 getSExtValue ();
528- LLVM_DEBUG (dbgs () << " [AGGREGATE] Array index out of bounds. End = " << End << " , DimSize = " << DimInfo.DimSize << " \n " );
519+ LLVM_DEBUG (dbgs () << " [AGGREGATE] Array index out of bounds. End = " <<
520+ End << " , DimSize = " << DimInfo.DimSize << " \n " );
529521 break ;
530522 }
531523 ResLoc.DimList .push_back (DimInfo);
@@ -878,7 +870,7 @@ void DataFlowTraits<ReachDFFwk*>::initialize(
878870 DU->addExplicitAccess (ALoc);
879871 auto ColLoc = aggregate (nullptr , nullptr , ALoc, DFF).first ;
880872 if (ColLoc.Kind == MemoryLocationRange::LocKind::Collapsed) {
881- DU->addExplicitAccessNode (ALoc. Ptr , N);
873+ DU->addNodeOfCollapsableExplicitAccess (ALoc, ColLoc , N);
882874 }
883875 }
884876 }
@@ -1101,22 +1093,6 @@ void ReachDFFwk::collapse(DFRegion *R) {
11011093 LLVM_DEBUG (printLocInfo (" [COLLAPSE] Collapse Use location: " , Loc));
11021094 distribute (aggregate (R, N, Loc, this ), Loc, OwnUses, OtherUses);
11031095 }
1104- /* LLVM_DEBUG(
1105- dbgs() << "[COLLAPSE] OwnUses:\n";
1106- for (auto &Loc : OwnUses)
1107- printLocationSource(dbgs(), Loc, &getDomTree(), true); dbgs() << "\n";
1108- dbgs() << "[COLLAPSE] OtherUses:\n";
1109- for (auto &Pair : OtherUses) {
1110- printLocationSource(dbgs(), Pair.first, &getDomTree(), true); dbgs() << "\n";
1111- printLocationSource(dbgs(), Pair.second, &getDomTree(), true); dbgs() << "\n";
1112- }
1113- );
1114- OwnUses.clarify(OtherUses);
1115- LLVM_DEBUG(
1116- dbgs() << "[COLLAPSE] OwnUses after clarify:\n";
1117- for (auto &Loc : OwnUses)
1118- printLocationSource(dbgs(), Loc, &getDomTree(), true); dbgs() << "\n";
1119- );*/
11201096 for (auto &Loc : OwnUses) {
11211097 SmallVector<MemoryLocationRange, 4 > UseDiff;
11221098 if (MustReachIn.subtractFrom (Loc, UseDiff)) {
@@ -1239,10 +1215,13 @@ void ReachDFFwk::collapse(DFRegion *R) {
12391215 EM = EM->getTopLevelParent ();
12401216 }
12411217 LLVM_DEBUG (printLocInfo (" [COLLAPSE] Collapse Explicit Access: " , Loc));
1242- auto *DFNS = DefUse->getCollapExpAccessNodes (Loc.Ptr );
1243- if (!DFNS)
1244- continue ;
1245- for (auto *N : *DFNS) {
1218+ auto *DFNS = DefUse->getNodesOfCollapsableExplicitAccess (Loc);
1219+ llvm::SmallVector<const DFNode *, 4 > Nodes;
1220+ if (DFNS)
1221+ Nodes.append (DFNS->begin (), DFNS->end ());
1222+ if (Nodes.empty ())
1223+ Nodes.push_back (nullptr );
1224+ for (auto *N : Nodes) {
12461225 MemoryLocationRange ExpLoc = aggregate (R, N, Loc, this ).first ;
12471226 MemoryLocationRange NewLoc (Loc);
12481227 NewLoc.Kind |= MemoryLocationRange::LocKind::Hint;
0 commit comments