forked from OSchip/llvm-project
[ZoneAlgo] Make ZoneAlgorithm::isNormalized out-of-quota safe.
The aosp-O3-polly-before-vectorizer-unprofitable buildbot currently fails in ZoneAlgorithm::isNormalized, presumably because an out-of-quota happens in that function. Modify ZoneAlgorithm::isNormalized to return an isl::boolean such it can report an error. In the failing case, it was called in an assertion in ForwardOpTree. Allow to pass the assertion in an out-of-quota event, a condition that is later checked before forwarding an operand tree. llvm-svn: 333709
This commit is contained in:
parent
91ab25bbe3
commit
d51fbfca46
|
@ -336,8 +336,8 @@ protected:
|
||||||
/// should have been replaced by their incoming values.
|
/// should have been replaced by their incoming values.
|
||||||
///
|
///
|
||||||
/// @see #NormalizedPHI
|
/// @see #NormalizedPHI
|
||||||
bool isNormalized(isl::map Map);
|
isl::boolean isNormalized(isl::map Map);
|
||||||
bool isNormalized(isl::union_map Map);
|
isl::boolean isNormalized(isl::union_map Map);
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -500,7 +500,8 @@ public:
|
||||||
|
|
||||||
// { DomainDef[] -> ValInst[] }
|
// { DomainDef[] -> ValInst[] }
|
||||||
isl::map ExpectedVal = makeValInst(Inst, UseStmt, UseLoop);
|
isl::map ExpectedVal = makeValInst(Inst, UseStmt, UseLoop);
|
||||||
assert(isNormalized(ExpectedVal) && "LoadInsts are always normalized");
|
assert(!isNormalized(ExpectedVal).is_false() &&
|
||||||
|
"LoadInsts are always normalized");
|
||||||
|
|
||||||
// { DomainUse[] -> DomainTarget[] }
|
// { DomainUse[] -> DomainTarget[] }
|
||||||
isl::map UseToTarget = getDefToTarget(UseStmt, TargetStmt);
|
isl::map UseToTarget = getDefToTarget(UseStmt, TargetStmt);
|
||||||
|
|
|
@ -842,20 +842,26 @@ bool ZoneAlgorithm::isNormalizable(MemoryAccess *MA) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneAlgorithm::isNormalized(isl::map Map) {
|
isl::boolean ZoneAlgorithm::isNormalized(isl::map Map) {
|
||||||
isl::space Space = Map.get_space();
|
isl::space Space = Map.get_space();
|
||||||
isl::space RangeSpace = Space.range();
|
isl::space RangeSpace = Space.range();
|
||||||
|
|
||||||
if (!RangeSpace.is_wrapping())
|
isl::boolean IsWrapping = RangeSpace.is_wrapping();
|
||||||
return true;
|
if (!IsWrapping.is_true())
|
||||||
|
return !IsWrapping;
|
||||||
|
isl::space Unwrapped = RangeSpace.unwrap();
|
||||||
|
|
||||||
auto *PHI = dyn_cast<PHINode>(static_cast<Value *>(
|
isl::id OutTupleId = Unwrapped.get_tuple_id(isl::dim::out);
|
||||||
RangeSpace.unwrap().get_tuple_id(isl::dim::out).get_user()));
|
if (OutTupleId.is_null())
|
||||||
|
return isl::boolean();
|
||||||
|
auto *PHI = dyn_cast<PHINode>(static_cast<Value *>(OutTupleId.get_user()));
|
||||||
if (!PHI)
|
if (!PHI)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto *IncomingStmt = static_cast<ScopStmt *>(
|
isl::id InTupleId = Unwrapped.get_tuple_id(isl::dim::in);
|
||||||
RangeSpace.unwrap().get_tuple_id(isl::dim::in).get_user());
|
if (OutTupleId.is_null())
|
||||||
|
return isl::boolean();
|
||||||
|
auto *IncomingStmt = static_cast<ScopStmt *>(InTupleId.get_user());
|
||||||
MemoryAccess *PHIRead = IncomingStmt->lookupPHIReadOf(PHI);
|
MemoryAccess *PHIRead = IncomingStmt->lookupPHIReadOf(PHI);
|
||||||
if (!isNormalizable(PHIRead))
|
if (!isNormalizable(PHIRead))
|
||||||
return true;
|
return true;
|
||||||
|
@ -863,13 +869,15 @@ bool ZoneAlgorithm::isNormalized(isl::map Map) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneAlgorithm::isNormalized(isl::union_map UMap) {
|
isl::boolean ZoneAlgorithm::isNormalized(isl::union_map UMap) {
|
||||||
auto Result = UMap.foreach_map([this](isl::map Map) -> isl::stat {
|
isl::boolean Result = true;
|
||||||
if (isNormalized(Map))
|
UMap.foreach_map([this, &Result](isl::map Map) -> isl::stat {
|
||||||
|
Result = isNormalized(Map);
|
||||||
|
if (Result.is_true())
|
||||||
return isl::stat::ok;
|
return isl::stat::ok;
|
||||||
return isl::stat::error;
|
return isl::stat::error;
|
||||||
});
|
});
|
||||||
return Result == isl::stat::ok;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneAlgorithm::computeCommon() {
|
void ZoneAlgorithm::computeCommon() {
|
||||||
|
|
Loading…
Reference in New Issue