@@ -385,15 +385,6 @@ std::pair<MemoryLocationRange, bool> aggregate(
385385 break ;
386386 }
387387 unsigned int TripCount = 0 ;
388- /* if (C->getLoop()->getLoopLatch() == C->getLoop()->getExitingBlock()) {
389- LLVM_DEBUG(dbgs() << "[AGGREGATE] Node kind: Latch and Exiting.\n");
390- TripCount = SE->getSmallConstantTripCount(C->getLoop());
391- } else {
392- LLVM_DEBUG(dbgs() << "[AGGREGATE] Node kind: Latch or Exiting.\n");
393- auto BTC = SE->getBackedgeTakenCount(C->getLoop());
394- if (isa<SCEVConstant>(BTC))
395- TripCount = cast<SCEVConstant>(BTC)->getAPInt().getZExtValue();
396- }*/
397388 if (C->getLoop ()->getLoopLatch () == C->getLoop ()->getExitingBlock ()) {
398389 LLVM_DEBUG (dbgs () << " [AGGREGATE] Node kind: Latch and Exiting.\n " );
399390 TripCount = SE->getSmallConstantTripCount (C->getLoop ());
@@ -524,7 +515,8 @@ std::pair<MemoryLocationRange, bool> aggregate(
524515 getSExtValue () >= DimInfo.DimSize && DimensionN != 0 && N != nullptr ) {
525516 auto End = cast<SCEVConstant>(DimInfo.End )->getAPInt ().
526517 getSExtValue ();
527- LLVM_DEBUG (dbgs () << " [AGGREGATE] Array index out of bounds. End = " << End << " , DimSize = " << DimInfo.DimSize << " \n " );
518+ LLVM_DEBUG (dbgs () << " [AGGREGATE] Array index out of bounds. End = " <<
519+ End << " , DimSize = " << DimInfo.DimSize << " \n " );
528520 break ;
529521 }
530522 ResLoc.DimList .push_back (DimInfo);
@@ -891,7 +883,7 @@ void DataFlowTraits<ReachDFFwk*>::initialize(
891883 DU->addExplicitAccess (ALoc);
892884 auto ColLoc = aggregate (nullptr , nullptr , ALoc, DFF).first ;
893885 if (ColLoc.Kind == MemoryLocationRange::LocKind::Collapsed) {
894- DU->addExplicitAccessNode (ALoc. Ptr , N);
886+ DU->addNodeOfCollapsableExplicitAccess (ALoc, ColLoc , N);
895887 }
896888 }
897889 }
@@ -1114,22 +1106,6 @@ void ReachDFFwk::collapse(DFRegion *R) {
11141106 LLVM_DEBUG (printLocInfo (" [COLLAPSE] Collapse Use location: " , Loc));
11151107 distribute (aggregate (R, N, Loc, this ), Loc, OwnUses, OtherUses);
11161108 }
1117- /* LLVM_DEBUG(
1118- dbgs() << "[COLLAPSE] OwnUses:\n";
1119- for (auto &Loc : OwnUses)
1120- printLocationSource(dbgs(), Loc, &getDomTree(), true); dbgs() << "\n";
1121- dbgs() << "[COLLAPSE] OtherUses:\n";
1122- for (auto &Pair : OtherUses) {
1123- printLocationSource(dbgs(), Pair.first, &getDomTree(), true); dbgs() << "\n";
1124- printLocationSource(dbgs(), Pair.second, &getDomTree(), true); dbgs() << "\n";
1125- }
1126- );
1127- OwnUses.clarify(OtherUses);
1128- LLVM_DEBUG(
1129- dbgs() << "[COLLAPSE] OwnUses after clarify:\n";
1130- for (auto &Loc : OwnUses)
1131- printLocationSource(dbgs(), Loc, &getDomTree(), true); dbgs() << "\n";
1132- );*/
11331109 for (auto &Loc : OwnUses) {
11341110 SmallVector<MemoryLocationRange, 4 > UseDiff;
11351111 if (MustReachIn.subtractFrom (Loc, UseDiff)) {
@@ -1252,10 +1228,13 @@ void ReachDFFwk::collapse(DFRegion *R) {
12521228 EM = EM->getTopLevelParent ();
12531229 }
12541230 LLVM_DEBUG (printLocInfo (" [COLLAPSE] Collapse Explicit Access: " , Loc));
1255- auto *DFNS = DefUse->getCollapExpAccessNodes (Loc.Ptr );
1256- if (!DFNS)
1257- continue ;
1258- for (auto *N : *DFNS) {
1231+ auto *DFNS = DefUse->getNodesOfCollapsableExplicitAccess (Loc);
1232+ llvm::SmallVector<const DFNode *, 4 > Nodes;
1233+ if (DFNS)
1234+ Nodes.append (DFNS->begin (), DFNS->end ());
1235+ if (Nodes.empty ())
1236+ Nodes.push_back (nullptr );
1237+ for (auto *N : Nodes) {
12591238 MemoryLocationRange ExpLoc = aggregate (R, N, Loc, this ).first ;
12601239 MemoryLocationRange NewLoc (Loc);
12611240 NewLoc.Kind |= MemoryLocationRange::LocKind::Hint;
0 commit comments