@@ -413,6 +413,7 @@ std::pair<MemoryLocationRange, bool> aggregate(
413413 break ;
414414 }
415415 } else {
416+ // TODO: more adequate value
416417 TripCount = 100500 ;
417418 }
418419 }
@@ -521,8 +522,10 @@ std::pair<MemoryLocationRange, bool> aggregate(
521522 " Dimension bounds and step must be specified!" );
522523 if (isa<SCEVConstant>(DimInfo.End ) &&
523524 cast<SCEVConstant>(DimInfo.End )->getAPInt ().
524- getSExtValue () >= DimInfo.DimSize && DimensionN != 0 ) {
525- LLVM_DEBUG (dbgs () << " [AGGREGATE] Array index out of bounds." );
525+ getSExtValue () >= DimInfo.DimSize && DimensionN != 0 && N != nullptr ) {
526+ auto End = cast<SCEVConstant>(DimInfo.End )->getAPInt ().
527+ getSExtValue ();
528+ LLVM_DEBUG (dbgs () << " [AGGREGATE] Array index out of bounds. End = " << End << " , DimSize = " << DimInfo.DimSize << " \n " );
526529 break ;
527530 }
528531 ResLoc.DimList .push_back (DimInfo);
@@ -875,7 +878,7 @@ void DataFlowTraits<ReachDFFwk*>::initialize(
875878 DU->addExplicitAccess (ALoc);
876879 auto ColLoc = aggregate (nullptr , nullptr , ALoc, DFF).first ;
877880 if (ColLoc.Kind == MemoryLocationRange::LocKind::Collapsed) {
878- DU->addExplicitAccessAndDFNode (ALoc.Ptr , N);
881+ DU->addExplicitAccessNode (ALoc.Ptr , N);
879882 }
880883 }
881884 }
@@ -1098,7 +1101,22 @@ void ReachDFFwk::collapse(DFRegion *R) {
10981101 LLVM_DEBUG (printLocInfo (" [COLLAPSE] Collapse Use location: " , Loc));
10991102 distribute (aggregate (R, N, Loc, this ), Loc, OwnUses, OtherUses);
11001103 }
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+ );
11011114 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+ );*/
11021120 for (auto &Loc : OwnUses) {
11031121 SmallVector<MemoryLocationRange, 4 > UseDiff;
11041122 if (MustReachIn.subtractFrom (Loc, UseDiff)) {
0 commit comments