mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-17 08:21:13 +00:00
[Polly][Isl] Use isl::union_map::unite() instead of isl::union_map::add_map(). NFC
This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.
Changes made:
- Use `isl::union_map::unite()` instead of `isl::union_map::add_map()`
- `isl-noexceptions.h` has been generated by this 3f43ae29fa
Depends on D106059
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D106061
This commit is contained in:
parent
d23f26f0af
commit
d5ee355f89
@ -660,7 +660,7 @@ bool Dependences::isValidSchedule(
|
||||
if (ScheduleSpace.is_null())
|
||||
ScheduleSpace = StmtScat.get_space().range();
|
||||
|
||||
Schedule = Schedule.add_map(StmtScat);
|
||||
Schedule = Schedule.unite(StmtScat);
|
||||
}
|
||||
|
||||
Dependences = Dependences.apply_domain(Schedule);
|
||||
|
@ -3369,7 +3369,7 @@ bool ScopBuilder::calculateMinMaxAccess(AliasGroupTy AliasGroup,
|
||||
isl::union_map Accesses = isl::union_map::empty(scop->getIslCtx());
|
||||
|
||||
for (MemoryAccess *MA : AliasGroup)
|
||||
Accesses = Accesses.add_map(MA->getAccessRelation());
|
||||
Accesses = Accesses.unite(MA->getAccessRelation());
|
||||
|
||||
Accesses = Accesses.intersect_domain(Domains);
|
||||
isl::union_set Locations = Accesses.range();
|
||||
|
@ -2324,7 +2324,7 @@ Scop::getAccessesOfType(std::function<bool(MemoryAccess &)> Predicate) {
|
||||
isl::set Domain = Stmt.getDomain();
|
||||
isl::map AccessDomain = MA->getAccessRelation();
|
||||
AccessDomain = AccessDomain.intersect_domain(Domain);
|
||||
Accesses = Accesses.add_map(AccessDomain);
|
||||
Accesses = Accesses.unite(AccessDomain);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,9 +324,9 @@ static bool importSchedule(Scop &S, const json::Object &JScop,
|
||||
auto ScheduleMap = isl::union_map::empty(S.getIslCtx());
|
||||
for (ScopStmt &Stmt : S) {
|
||||
if (NewSchedule.find(&Stmt) != NewSchedule.end())
|
||||
ScheduleMap = ScheduleMap.add_map(NewSchedule[&Stmt]);
|
||||
ScheduleMap = ScheduleMap.unite(NewSchedule[&Stmt]);
|
||||
else
|
||||
ScheduleMap = ScheduleMap.add_map(Stmt.getSchedule());
|
||||
ScheduleMap = ScheduleMap.unite(Stmt.getSchedule());
|
||||
}
|
||||
|
||||
S.setSchedule(ScheduleMap);
|
||||
|
@ -3211,7 +3211,6 @@ public:
|
||||
inline isl::ctx ctx() const;
|
||||
inline void dump() const;
|
||||
|
||||
inline isl::union_map add_map(isl::map map) const;
|
||||
inline isl::union_map affine_hull() const;
|
||||
inline isl::union_map align_params(isl::space model) const;
|
||||
inline isl::union_map apply_domain(isl::union_map umap2) const;
|
||||
@ -17463,12 +17462,6 @@ void union_map::dump() const {
|
||||
}
|
||||
|
||||
|
||||
isl::union_map union_map::add_map(isl::map map) const
|
||||
{
|
||||
auto res = isl_union_map_add_map(copy(), map.release());
|
||||
return manage(res);
|
||||
}
|
||||
|
||||
isl::union_map union_map::affine_hull() const
|
||||
{
|
||||
auto res = isl_union_map_affine_hull(copy());
|
||||
|
@ -94,7 +94,7 @@ isl::union_map polly::beforeScatter(isl::union_map UMap, bool Strict) {
|
||||
|
||||
for (isl::map Map : UMap.get_map_list()) {
|
||||
isl::map After = beforeScatter(Map, Strict);
|
||||
Result = Result.add_map(After);
|
||||
Result = Result.unite(After);
|
||||
}
|
||||
|
||||
return Result;
|
||||
@ -111,7 +111,7 @@ isl::union_map polly::afterScatter(const isl::union_map &UMap, bool Strict) {
|
||||
isl::union_map Result = isl::union_map::empty(UMap.ctx());
|
||||
for (isl::map Map : UMap.get_map_list()) {
|
||||
isl::map After = afterScatter(Map, Strict);
|
||||
Result = Result.add_map(After);
|
||||
Result = Result.unite(After);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -191,7 +191,7 @@ isl::union_map polly::makeIdentityMap(const isl::union_set &USet,
|
||||
isl::union_map Result = isl::union_map::empty(USet.ctx());
|
||||
for (isl::set Set : USet.get_set_list()) {
|
||||
isl::map IdentityMap = makeIdentityMap(Set, RestrictDomain);
|
||||
Result = Result.add_map(IdentityMap);
|
||||
Result = Result.unite(IdentityMap);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -208,7 +208,7 @@ isl::union_map polly::reverseDomain(const isl::union_map &UMap) {
|
||||
isl::union_map Result = isl::union_map::empty(UMap.ctx());
|
||||
for (isl::map Map : UMap.get_map_list()) {
|
||||
auto Reversed = reverseDomain(std::move(Map));
|
||||
Result = Result.add_map(Reversed);
|
||||
Result = Result.unite(Reversed);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -269,7 +269,7 @@ isl::union_map polly::shiftDim(isl::union_map UMap, isl::dim Dim, int Pos,
|
||||
|
||||
for (isl::map Map : UMap.get_map_list()) {
|
||||
isl::map Shifted = shiftDim(Map, Dim, Pos, Amount);
|
||||
Result = Result.add_map(Shifted);
|
||||
Result = Result.unite(Shifted);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -489,7 +489,7 @@ isl::union_map polly::distributeDomain(isl::union_map UMap) {
|
||||
isl::union_map Result = isl::union_map::empty(UMap.ctx());
|
||||
for (isl::map Map : UMap.get_map_list()) {
|
||||
auto Distributed = distributeDomain(Map);
|
||||
Result = Result.add_map(Distributed);
|
||||
Result = Result.unite(Distributed);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ isl::union_map scheduleProjectOut(const isl::union_map &UMap, unsigned first,
|
||||
auto Result = isl::union_map::empty(UMap.ctx());
|
||||
for (isl::map Map : UMap.get_map_list()) {
|
||||
auto Outprojected = Map.project_out(isl::dim::out, first, n);
|
||||
Result = Result.add_map(Outprojected);
|
||||
Result = Result.unite(Outprojected);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -147,7 +147,7 @@ isl::union_pw_aff scheduleExtractDimAff(isl::union_map UMap, unsigned pos) {
|
||||
unsigned MapDims = Map.range_tuple_dim();
|
||||
isl::map SingleMap = Map.project_out(isl::dim::out, 0, pos);
|
||||
SingleMap = SingleMap.project_out(isl::dim::out, 1, MapDims - pos - 1);
|
||||
SingleUMap = SingleUMap.add_map(SingleMap);
|
||||
SingleUMap = SingleUMap.unite(SingleMap);
|
||||
};
|
||||
|
||||
auto UAff = isl::union_pw_multi_aff(SingleUMap);
|
||||
|
@ -584,7 +584,7 @@ public:
|
||||
(void)Access;
|
||||
|
||||
if (!LocalTranslator.is_null())
|
||||
Translator = Translator.add_map(LocalTranslator);
|
||||
Translator = Translator.unite(LocalTranslator);
|
||||
|
||||
NumKnownLoadsForwarded++;
|
||||
TotalKnownLoadsForwarded++;
|
||||
|
@ -161,7 +161,7 @@ isl::union_map MaximalStaticExpander::filterDependences(
|
||||
continue;
|
||||
|
||||
// Add the corresponding map to MapDependences.
|
||||
MapDependences = MapDependences.add_map(NewMap);
|
||||
MapDependences = MapDependences.unite(NewMap);
|
||||
}
|
||||
|
||||
return MapDependences;
|
||||
|
@ -248,7 +248,7 @@ struct ExtensionNodeRewriter
|
||||
if (OuterDims > 0) {
|
||||
isl::map OuterSched =
|
||||
Ext.project_out(isl::dim::in, OuterDims, BandDims);
|
||||
OuterExtensions = OuterExtensions.add_map(OuterSched);
|
||||
OuterExtensions = OuterExtensions.unite(OuterSched);
|
||||
}
|
||||
}
|
||||
isl::multi_union_pw_aff NewPartialSchedAsAsMultiUnionPwAff =
|
||||
|
@ -81,7 +81,7 @@ static bool isImplicitWrite(MemoryAccess *MA) {
|
||||
return MA->isWrite() && MA->isOriginalScalarKind();
|
||||
}
|
||||
|
||||
/// Like isl::union_map::add_map, but may also return an underapproximated
|
||||
/// Like isl::union_map::unite, but may also return an underapproximated
|
||||
/// result if getting too complex.
|
||||
///
|
||||
/// This is implemented by adding disjuncts to the results until the limit is
|
||||
@ -97,7 +97,7 @@ static isl::union_map underapproximatedAddMap(isl::union_map UMap,
|
||||
// them.
|
||||
if (isl_map_n_basic_map(PrevMap.get()) + isl_map_n_basic_map(Map.get()) <=
|
||||
SimplifyMaxDisjuncts)
|
||||
return UMap.add_map(Map);
|
||||
return UMap.unite(Map);
|
||||
|
||||
isl::map Result = isl::map::empty(PrevMap.get_space());
|
||||
for (isl::basic_map BMap : PrevMap.get_basic_map_list()) {
|
||||
@ -113,7 +113,7 @@ static isl::union_map underapproximatedAddMap(isl::union_map UMap,
|
||||
|
||||
isl::union_map UResult =
|
||||
UMap.subtract(isl::map::universe(PrevMap.get_space()));
|
||||
UResult.add_map(Result);
|
||||
UResult.unite(Result);
|
||||
|
||||
return UResult;
|
||||
}
|
||||
@ -451,7 +451,7 @@ void SimplifyImpl::coalesceWrites() {
|
||||
.get_tuple_id(isl::dim::out)
|
||||
.get_user();
|
||||
if (!TouchedAccesses.count(MA))
|
||||
NewFutureWrites = NewFutureWrites.add_map(FutureWrite);
|
||||
NewFutureWrites = NewFutureWrites.unite(FutureWrite);
|
||||
}
|
||||
FutureWrites = NewFutureWrites;
|
||||
|
||||
@ -467,7 +467,7 @@ void SimplifyImpl::coalesceWrites() {
|
||||
// { [Domain[] -> Element[]] -> [Value[] -> MemoryAccess[]] }
|
||||
isl::map AccRelValAcc =
|
||||
isl::map::from_domain_and_range(AccRelWrapped, ValAccSet.wrap());
|
||||
FutureWrites = FutureWrites.add_map(AccRelValAcc);
|
||||
FutureWrites = FutureWrites.unite(AccRelValAcc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -551,7 +551,7 @@ void SimplifyImpl::removeRedundantWrites() {
|
||||
isl::map AccRelVal = isl::map::from_domain_and_range(
|
||||
AccRelWrapped, makeValueSet(LoadedVal));
|
||||
|
||||
Known = Known.add_map(AccRelVal);
|
||||
Known = Known.unite(AccRelVal);
|
||||
}
|
||||
} else if (MA->isWrite()) {
|
||||
// Remove (possibly) overwritten values from the known elements set.
|
||||
|
@ -253,7 +253,7 @@ isl::union_map polly::filterKnownValInst(const isl::union_map &UMap) {
|
||||
isl::union_map Result = isl::union_map::empty(UMap.ctx());
|
||||
for (isl::map Map : UMap.get_map_list()) {
|
||||
if (!isMapToUnknown(Map))
|
||||
Result = Result.add_map(Map);
|
||||
Result = Result.unite(Map);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -394,7 +394,7 @@ void ZoneAlgorithm::addArrayReadAccess(MemoryAccess *MA) {
|
||||
|
||||
// { DomainRead[] -> Element[] }
|
||||
auto AccRel = intersectRange(getAccessRelationFor(MA), CompatibleElts);
|
||||
AllReads = AllReads.add_map(AccRel);
|
||||
AllReads = AllReads.unite(AccRel);
|
||||
|
||||
if (LoadInst *Load = dyn_cast_or_null<LoadInst>(MA->getAccessInstruction())) {
|
||||
// { DomainRead[] -> ValInst[] }
|
||||
@ -407,7 +407,7 @@ void ZoneAlgorithm::addArrayReadAccess(MemoryAccess *MA) {
|
||||
// { [Element[] -> DomainRead[]] -> ValInst[] }
|
||||
isl::map EltLoadValInst = LoadValInst.apply_domain(IncludeElement);
|
||||
|
||||
AllReadValInst = AllReadValInst.add_map(EltLoadValInst);
|
||||
AllReadValInst = AllReadValInst.unite(EltLoadValInst);
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,10 +452,10 @@ void ZoneAlgorithm::addArrayWriteAccess(MemoryAccess *MA) {
|
||||
isl::map AccRel = intersectRange(getAccessRelationFor(MA), CompatibleElts);
|
||||
|
||||
if (MA->isMustWrite())
|
||||
AllMustWrites = AllMustWrites.add_map(AccRel);
|
||||
AllMustWrites = AllMustWrites.unite(AccRel);
|
||||
|
||||
if (MA->isMayWrite())
|
||||
AllMayWrites = AllMayWrites.add_map(AccRel);
|
||||
AllMayWrites = AllMayWrites.unite(AccRel);
|
||||
|
||||
// { Domain[] -> ValInst[] }
|
||||
isl::union_map WriteValInstance = getWrittenValue(MA, AccRel);
|
||||
@ -556,7 +556,7 @@ isl::union_map ZoneAlgorithm::computePerPHI(const ScopArrayInfo *SAI) {
|
||||
// Collect all incoming block timepoints.
|
||||
for (MemoryAccess *MA : S->getPHIIncomings(SAI)) {
|
||||
isl::map Scatter = getScatterFor(MA);
|
||||
PHIWriteScatter = PHIWriteScatter.add_map(Scatter);
|
||||
PHIWriteScatter = PHIWriteScatter.unite(Scatter);
|
||||
}
|
||||
|
||||
// { DomainPHIRead[] -> Scatter[] }
|
||||
@ -853,7 +853,7 @@ static isl::union_map normalizeValInst(isl::union_map Input,
|
||||
// Instructions within the SCoP are always wrapped. Non-wrapped tuples
|
||||
// are therefore invariant in the SCoP and don't need normalization.
|
||||
if (!RangeSpace.is_wrapping()) {
|
||||
Result = Result.add_map(Map);
|
||||
Result = Result.unite(Map);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -862,7 +862,7 @@ static isl::union_map normalizeValInst(isl::union_map Input,
|
||||
|
||||
// If no normalization is necessary, then the ValInst stands for itself.
|
||||
if (!ComputedPHIs.count(PHI)) {
|
||||
Result = Result.add_map(Map);
|
||||
Result = Result.unite(Map);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1057,7 +1057,7 @@ void ZoneAlgorithm::computeNormalizedPHIs() {
|
||||
isl::map IncomingValInst = makeValInst(
|
||||
IncomingVal, IncomingStmt, IncomingStmt->getSurroundingLoop());
|
||||
|
||||
IncomingValInsts = IncomingValInsts.add_map(IncomingValInst);
|
||||
IncomingValInsts = IncomingValInsts.unite(IncomingValInst);
|
||||
}
|
||||
|
||||
// { PHIValInst[] -> IncomingValInst[] }
|
||||
|
@ -53,7 +53,7 @@ void completeLifetime(isl::union_set Universe, isl::union_map OccupiedAndKnown,
|
||||
for (isl::map Map : OccupiedAndKnown.get_map_list()) {
|
||||
if (!Map.has_tuple_name(isl::dim::out))
|
||||
continue;
|
||||
Known = Known.add_map(Map);
|
||||
Known = Known.unite(Map);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user