@@ -412,6 +412,7 @@ std::pair<MemoryLocationRange, bool> aggregate(
412412 break ;
413413 }
414414 } else {
415+ // TODO: more adequate value
415416 TripCount = 100500 ;
416417 }
417418 }
@@ -520,8 +521,10 @@ std::pair<MemoryLocationRange, bool> aggregate(
520521 " Dimension bounds and step must be specified!" );
521522 if (isa<SCEVConstant>(DimInfo.End ) &&
522523 cast<SCEVConstant>(DimInfo.End )->getAPInt ().
523- getSExtValue () >= DimInfo.DimSize && DimensionN != 0 ) {
524- LLVM_DEBUG (dbgs () << " [AGGREGATE] Array index out of bounds." );
524+ getSExtValue () >= DimInfo.DimSize && DimensionN != 0 && N != nullptr ) {
525+ auto End = cast<SCEVConstant>(DimInfo.End )->getAPInt ().
526+ getSExtValue ();
527+ LLVM_DEBUG (dbgs () << " [AGGREGATE] Array index out of bounds. End = " << End << " , DimSize = " << DimInfo.DimSize << " \n " );
525528 break ;
526529 }
527530 ResLoc.DimList .push_back (DimInfo);
@@ -888,7 +891,7 @@ void DataFlowTraits<ReachDFFwk*>::initialize(
888891 DU->addExplicitAccess (ALoc);
889892 auto ColLoc = aggregate (nullptr , nullptr , ALoc, DFF).first ;
890893 if (ColLoc.Kind == MemoryLocationRange::LocKind::Collapsed) {
891- DU->addExplicitAccessAndDFNode (ALoc.Ptr , N);
894+ DU->addExplicitAccessNode (ALoc.Ptr , N);
892895 }
893896 }
894897 }
@@ -1111,7 +1114,22 @@ void ReachDFFwk::collapse(DFRegion *R) {
11111114 LLVM_DEBUG (printLocInfo (" [COLLAPSE] Collapse Use location: " , Loc));
11121115 distribute (aggregate (R, N, Loc, this ), Loc, OwnUses, OtherUses);
11131116 }
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+ );
11141127 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+ );*/
11151133 for (auto &Loc : OwnUses) {
11161134 SmallVector<MemoryLocationRange, 4 > UseDiff;
11171135 if (MustReachIn.subtractFrom (Loc, UseDiff)) {
0 commit comments