From 7164b7d3472611c04bc2d52b99d9ea7718fce62e Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 9 Aug 2018 05:07:14 +0000 Subject: [PATCH] Update isl-cpp bindings We upstreamed the export of isl_val_2exp, to the official cpp bindings. In this process, we concluded that pow2 is a better and more widely used name for this functionality. Hence, both the official isl-cpp bindings and our derived variant use now the term pow2. llvm-svn: 339312 --- .../External/isl/include/isl/isl-noexceptions.h | 16 ++++++++-------- polly/lib/Support/SCEVAffinator.cpp | 2 +- polly/unittests/Isl/IslTest.cpp | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/polly/lib/External/isl/include/isl/isl-noexceptions.h b/polly/lib/External/isl/include/isl/isl-noexceptions.h index a66d539f6d55..bb87b88510a8 100644 --- a/polly/lib/External/isl/include/isl/isl-noexceptions.h +++ b/polly/lib/External/isl/include/isl/isl-noexceptions.h @@ -3659,7 +3659,6 @@ public: inline std::string to_str() const; inline void dump() const; - inline val two_exp() const; inline val abs() const; inline boolean abs_eq(const val &v2) const; inline val add(val v2) const; @@ -3706,6 +3705,7 @@ public: static inline val neginfty(ctx ctx); static inline val negone(ctx ctx); static inline val one(ctx ctx); + inline val pow2() const; inline val set_si(long i) const; inline int sgn() const; inline val sub(val v2) const; @@ -14168,7 +14168,7 @@ stat schedule_node::foreach_ancestor_top_down(const std::function isl_stat { auto *data = static_cast(arg_1); - stat ret = (*data->func)(manage(arg_0)); + stat ret = (*data->func)(manage_copy(arg_0)); return ret.release(); }; auto res = isl_schedule_node_foreach_ancestor_top_down(get(), fn_lambda, &fn_data); @@ -19087,12 +19087,6 @@ void val::dump() const { } -val val::two_exp() const -{ - auto res = isl_val_2exp(copy()); - return manage(res); -} - val val::abs() const { auto res = isl_val_abs(copy()); @@ -19369,6 +19363,12 @@ val val::one(ctx ctx) return manage(res); } +val val::pow2() const +{ + auto res = isl_val_pow2(copy()); + return manage(res); +} + val val::set_si(long i) const { auto res = isl_val_set_si(copy(), i); diff --git a/polly/lib/Support/SCEVAffinator.cpp b/polly/lib/Support/SCEVAffinator.cpp index 6c38e2a41f3d..d00d6d6f0f55 100644 --- a/polly/lib/Support/SCEVAffinator.cpp +++ b/polly/lib/Support/SCEVAffinator.cpp @@ -157,7 +157,7 @@ isl::pw_aff SCEVAffinator::addModuloSemantic(isl::pw_aff PWA, unsigned Width = TD.getTypeSizeInBits(ExprType); auto ModVal = isl::val::int_from_ui(Ctx, Width); - ModVal = ModVal.two_exp(); + ModVal = ModVal.pow2(); isl::set Domain = PWA.domain(); isl::pw_aff AddPW = diff --git a/polly/unittests/Isl/IslTest.cpp b/polly/unittests/Isl/IslTest.cpp index ed88c5a7d19b..984264e293e0 100644 --- a/polly/unittests/Isl/IslTest.cpp +++ b/polly/unittests/Isl/IslTest.cpp @@ -145,7 +145,7 @@ TEST(Isl, APIntToIslVal) { { APInt APNOne(32, (1ull << 32) - 1, false); auto IslNOne = valFromAPInt(IslCtx, APNOne, false); - auto IslRef = isl::val(IslCtx, 32).two_exp().sub_ui(1); + auto IslRef = isl::val(IslCtx, 32).pow2().sub_ui(1); EXPECT_EQ(IslNOne, IslRef); } @@ -154,7 +154,7 @@ TEST(Isl, APIntToIslVal) { APLarge = APLarge.shl(70); auto IslLarge = valFromAPInt(IslCtx, APLarge, false); auto IslRef = isl::val(IslCtx, 71); - IslRef = IslRef.two_exp(); + IslRef = IslRef.pow2(); EXPECT_EQ(IslLarge, IslRef); } @@ -232,7 +232,7 @@ TEST(Isl, IslValToAPInt) { } { - auto IslNOne = isl::val(IslCtx, 32).two_exp().sub_ui(1); + auto IslNOne = isl::val(IslCtx, 32).pow2().sub_ui(1); auto APNOne = APIntFromVal(IslNOne); EXPECT_EQ((1ull << 32) - 1, APNOne); EXPECT_EQ(33u, APNOne.getBitWidth()); @@ -240,7 +240,7 @@ TEST(Isl, IslValToAPInt) { { auto IslLargeNum = isl::val(IslCtx, 60); - IslLargeNum = IslLargeNum.two_exp(); + IslLargeNum = IslLargeNum.pow2(); IslLargeNum = IslLargeNum.sub_ui(1); auto APLargeNum = APIntFromVal(IslLargeNum); EXPECT_EQ((1ull << 60) - 1, APLargeNum); @@ -249,7 +249,7 @@ TEST(Isl, IslValToAPInt) { { auto IslExp = isl::val(IslCtx, 500); - auto IslLargePow2 = IslExp.two_exp(); + auto IslLargePow2 = IslExp.pow2(); auto APLargePow2 = APIntFromVal(IslLargePow2); EXPECT_TRUE(APLargePow2.isPowerOf2()); EXPECT_EQ(502u, APLargePow2.getBitWidth()); @@ -258,7 +258,7 @@ TEST(Isl, IslValToAPInt) { { auto IslExp = isl::val(IslCtx, 500); - auto IslLargeNPow2 = IslExp.two_exp().neg(); + auto IslLargeNPow2 = IslExp.pow2().neg(); auto APLargeNPow2 = APIntFromVal(IslLargeNPow2); EXPECT_EQ(501u, APLargeNPow2.getBitWidth()); EXPECT_EQ(501u, APLargeNPow2.getMinSignedBits()); @@ -267,7 +267,7 @@ TEST(Isl, IslValToAPInt) { { auto IslExp = isl::val(IslCtx, 512); - auto IslLargePow2 = IslExp.two_exp(); + auto IslLargePow2 = IslExp.pow2(); auto APLargePow2 = APIntFromVal(IslLargePow2); EXPECT_TRUE(APLargePow2.isPowerOf2()); EXPECT_EQ(514u, APLargePow2.getBitWidth()); @@ -276,7 +276,7 @@ TEST(Isl, IslValToAPInt) { { auto IslExp = isl::val(IslCtx, 512); - auto IslLargeNPow2 = IslExp.two_exp().neg(); + auto IslLargeNPow2 = IslExp.pow2().neg(); auto APLargeNPow2 = APIntFromVal(IslLargeNPow2); EXPECT_EQ(513u, APLargeNPow2.getBitWidth()); EXPECT_EQ(513u, APLargeNPow2.getMinSignedBits());