typedef std::set<const Region *> RegionSet;
RegionSet ValidRegions;
- // Invalid regions and the reason they fail.
- std::map<const Region *, std::string> InvalidRegions;
-
// Remember a list of errors for every region.
mutable std::map<const Region *, RejectLog> RejectLogs;
// Remember the invalid functions producted by backends;
typedef std::set<const Function *> FunctionSet;
FunctionSet InvalidFunctions;
- mutable std::string LastFailure;
// Delinearize all non affine memory accesses and return false when there
// exists a non affine memory access that cannot be delinearized. Return true
RejectLog &Log = Context.Log;
std::shared_ptr<RR> RejectReason = std::make_shared<RR>(Arguments...);
- if (PollyTrackFailures) {
+ if (PollyTrackFailures)
Log.report(RejectReason);
- LastFailure = RejectReason->getMessage();
- }
DEBUG(dbgs() << RejectReason->getMessage());
DEBUG(dbgs() << "\n");
}
std::string ScopDetection::regionIsInvalidBecause(const Region *R) const {
- if (!InvalidRegions.count(R))
+ if (!RejectLogs.count(R))
return "";
- return InvalidRegions.find(R)->second;
+ // Get the first error we found. Even in keep-going mode, this is the first
+ // reason that caused the candidate to be rejected.
+ RejectLog Errors = RejectLogs.at(R);
+ return (*Errors.begin())->getMessage();
}
bool ScopDetection::isValidCFG(BasicBlock &BB,
if (!DetectRegionsWithoutLoops && regionWithoutLoops(R, LI))
return;
- LastFailure = "";
-
if (isValidRegion(R)) {
++ValidRegion;
ValidRegions.insert(&R);
return;
}
- InvalidRegions[&R] = LastFailure;
-
for (auto &SubRegion : R)
findScops(*SubRegion);
void ScopDetection::releaseMemory() {
ValidRegions.clear();
- InvalidRegions.clear();
RejectLogs.clear();
// Do not clear the invalid function set.