[polly] r331119 - [islpp] Remove use of isl::give from unittests
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 28 14:06:15 PDT 2018
Author: grosser
Date: Sat Apr 28 14:06:14 2018
New Revision: 331119
URL: http://llvm.org/viewvc/llvm-project?rev=331119&view=rev
Log:
[islpp] Remove use of isl::give from unittests
We do this mostly by just moving directly to pure C++ code.
Modified:
polly/trunk/unittests/DeLICM/DeLICMTest.cpp
polly/trunk/unittests/Flatten/FlattenTest.cpp
polly/trunk/unittests/Isl/IslTest.cpp
Modified: polly/trunk/unittests/DeLICM/DeLICMTest.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/unittests/DeLICM/DeLICMTest.cpp?rev=331119&r1=331118&r2=331119&view=diff
==============================================================================
--- polly/trunk/unittests/DeLICM/DeLICMTest.cpp (original)
+++ polly/trunk/unittests/DeLICM/DeLICMTest.cpp Sat Apr 28 14:06:14 2018
@@ -23,11 +23,11 @@ namespace {
/// Get the universes of all spaces in @p USet.
isl::union_set unionSpace(const isl::union_set &USet) {
- auto Result = give(isl_union_set_empty(isl_union_set_get_space(USet.keep())));
+ auto Result = isl::union_set::empty(USet.get_space());
USet.foreach_set([=, &Result](isl::set Set) -> isl::stat {
- auto Space = give(isl_set_get_space(Set.keep()));
- auto Universe = give(isl_set_universe(Space.take()));
- Result = give(isl_union_set_add_set(Result.take(), Universe.take()));
+ auto Space = Set.get_space();
+ auto Universe = isl::set::universe(Space);
+ Result = Result.add_set(Universe);
return isl::stat::ok;
});
return Result;
@@ -36,11 +36,11 @@ isl::union_set unionSpace(const isl::uni
void completeLifetime(isl::union_set Universe, isl::union_map OccupiedAndKnown,
isl::union_set &Occupied, isl::union_map &Known,
isl::union_set &Undef) {
- auto ParamSpace = give(isl_union_set_get_space(Universe.keep()));
+ auto ParamSpace = Universe.get_space();
if (Undef && !Occupied) {
assert(!Occupied);
- Occupied = give(isl_union_set_subtract(Universe.copy(), Undef.copy()));
+ Occupied = Universe.subtract(Undef);
}
if (OccupiedAndKnown) {
@@ -54,14 +54,14 @@ void completeLifetime(isl::union_set Uni
OccupiedAndKnown.foreach_map([&Known](isl::map Map) -> isl::stat {
if (isl_map_has_tuple_name(Map.keep(), isl_dim_out) != isl_bool_true)
return isl::stat::ok;
- Known = give(isl_union_map_add_map(Known.take(), Map.take()));
+ Known = Known.add_map(Map);
return isl::stat::ok;
});
}
if (!Undef) {
assert(Occupied);
- Undef = give(isl_union_set_subtract(Universe.copy(), Occupied.copy()));
+ Undef = Universe.subtract(Occupied);
}
if (!Known) { // By default, nothing is known.
@@ -98,38 +98,31 @@ bool checkIsConflictingNonsymmetricCommo
isl::union_map ProposedOccupiedAndKnown, isl::union_set ProposedUnused,
isl::union_map ProposedWritten) {
// Determine universe (set of all possible domains).
- auto Universe = give(isl_union_set_empty(isl_space_params_alloc(Ctx, 0)));
+ auto Universe = isl::union_set::empty(isl::space::params_alloc(Ctx, 0));
if (ExistingOccupiedAndKnown)
- Universe = give(isl_union_set_union(
- Universe.take(), ExistingOccupiedAndKnown.domain().take()));
+ Universe = Universe.unite(ExistingOccupiedAndKnown.domain());
if (ExistingUnused)
- Universe =
- give(isl_union_set_union(Universe.take(), ExistingUnused.copy()));
+ Universe = Universe.unite(ExistingUnused);
if (ExistingWritten)
- Universe = give(
- isl_union_set_union(Universe.take(), ExistingWritten.domain().take()));
+ Universe = Universe.unite(ExistingWritten.domain());
if (ProposedOccupiedAndKnown)
- Universe = give(isl_union_set_union(
- Universe.take(), ProposedOccupiedAndKnown.domain().take()));
+ Universe = Universe.unite(ProposedOccupiedAndKnown.domain());
if (ProposedUnused)
- Universe =
- give(isl_union_set_union(Universe.take(), ProposedUnused.copy()));
+ Universe = Universe.unite(ProposedUnused);
if (ProposedWritten)
- Universe = give(
- isl_union_set_union(Universe.take(), ProposedWritten.domain().take()));
+ Universe = Universe.unite(ProposedWritten.domain());
Universe = unionSpace(Universe);
// Add a space the universe that does not occur anywhere else to ensure
// robustness. Use &NewId to ensure that this Id is unique.
- isl::id NewId = give(isl_id_alloc(Ctx, "Unrelated", &NewId));
+ isl::id NewId = isl::id::alloc(Ctx, "Unrelated", &NewId);
// The space must contains at least one dimension to allow order
// modifications.
- auto NewSpace = give(isl_space_set_alloc(Ctx, 0, 1));
- NewSpace =
- give(isl_space_set_tuple_id(NewSpace.take(), isl_dim_set, NewId.copy()));
- auto NewSet = give(isl_set_universe(NewSpace.take()));
- Universe = give(isl_union_set_add_set(Universe.take(), NewSet.take()));
+ auto NewSpace = isl::space(Ctx, 0, 1);
+ NewSpace = NewSpace.set_tuple_id(isl::dim::set, NewId);
+ auto NewSet = isl::set::universe(NewSpace);
+ Universe = Universe.add_set(NewSet);
// Using the universe, fill missing data.
isl::union_set ExistingOccupied;
Modified: polly/trunk/unittests/Flatten/FlattenTest.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/unittests/Flatten/FlattenTest.cpp?rev=331119&r1=331118&r2=331119&view=diff
==============================================================================
--- polly/trunk/unittests/Flatten/FlattenTest.cpp (original)
+++ polly/trunk/unittests/Flatten/FlattenTest.cpp Sat Apr 28 14:06:14 2018
@@ -28,8 +28,8 @@ bool checkFlatten(const char *ScheduleSt
isl_bool Success;
{
- auto Schedule = give(isl_union_map_read_from_str(Ctx, ScheduleStr));
- auto Expected = give(isl_union_map_read_from_str(Ctx, ExpectedStr));
+ auto Schedule = isl::union_map(Ctx, ScheduleStr);
+ auto Expected = isl::union_map(Ctx, ExpectedStr);
auto Result = flattenSchedule(std::move(Schedule));
Success = isl_union_map_is_equal(Result.keep(), Expected.keep());
Modified: polly/trunk/unittests/Isl/IslTest.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/unittests/Isl/IslTest.cpp?rev=331119&r1=331118&r2=331119&view=diff
==============================================================================
--- polly/trunk/unittests/Isl/IslTest.cpp (original)
+++ polly/trunk/unittests/Isl/IslTest.cpp Sat Apr 28 14:06:14 2018
@@ -23,9 +23,9 @@ static isl::space parseSpace(isl_ctx *Ct
isl::space Result;
if (Obj.type == isl_obj_set)
- Result = give(isl_set_get_space(static_cast<isl_set *>(Obj.v)));
+ Result = isl::manage(isl_set_get_space(static_cast<isl_set *>(Obj.v)));
else if (Obj.type == isl_obj_map)
- Result = give(isl_map_get_space(static_cast<isl_map *>(Obj.v)));
+ Result = isl::manage(isl_map_get_space(static_cast<isl_map *>(Obj.v)));
isl_stream_free(Stream);
if (Obj.type)
More information about the llvm-commits
mailing list