[polly] f959327 - [Polly][NFC] Convert ScopBuilder::buildUnsignedConditionSets() to isl++ (#190487)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 4 14:01:25 PDT 2026
Author: Michael Kruse
Date: 2026-04-04T21:01:20Z
New Revision: f959327bc8a0cc4d88d7db58367d5bfde12eb7c2
URL: https://github.com/llvm/llvm-project/commit/f959327bc8a0cc4d88d7db58367d5bfde12eb7c2
DIFF: https://github.com/llvm/llvm-project/commit/f959327bc8a0cc4d88d7db58367d5bfde12eb7c2.diff
LOG: [Polly][NFC] Convert ScopBuilder::buildUnsignedConditionSets() to isl++ (#190487)
Added:
Modified:
polly/include/polly/ScopBuilder.h
polly/lib/Analysis/ScopBuilder.cpp
Removed:
################################################################################
diff --git a/polly/include/polly/ScopBuilder.h b/polly/include/polly/ScopBuilder.h
index 1e433800b5903..a718a5efece62 100644
--- a/polly/include/polly/ScopBuilder.h
+++ b/polly/include/polly/ScopBuilder.h
@@ -161,8 +161,8 @@ class ScopBuilder final {
/// Set @p IsInsideDomain to false when building the conditions that check
/// whether @p BB is to be executed, since we are not in its domain yet.
/// TestVal < UpperBound OR TestVal <= UpperBound
- __isl_give isl_set *buildUnsignedConditionSets(
- BasicBlock *BB, Value *Condition, __isl_keep isl_set *Domain,
+ isl::set buildUnsignedConditionSets(
+ BasicBlock *BB, Value *Condition, const isl::set &Domain,
const SCEV *SCEV_TestVal, const SCEV *SCEV_UpperBound,
DenseMap<BasicBlock *, isl::set> &InvalidDomainMap,
bool IsStrictUpperBound, bool IsInsideDomain = true);
diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp
index 6a39c1f1c5432..762a930dfea6f 100644
--- a/polly/lib/Analysis/ScopBuilder.cpp
+++ b/polly/lib/Analysis/ScopBuilder.cpp
@@ -351,36 +351,32 @@ ScopBuilder::getPwAff(BasicBlock *BB,
/// @param IsStrictUpperBound holds information on the predicate relation
/// between TestVal and UpperBound, i.e,
/// TestVal < UpperBound OR TestVal <= UpperBound
-__isl_give isl_set *ScopBuilder::buildUnsignedConditionSets(
- BasicBlock *BB, Value *Condition, __isl_keep isl_set *Domain,
+isl::set ScopBuilder::buildUnsignedConditionSets(
+ BasicBlock *BB, Value *Condition, const isl::set &Domain,
const SCEV *SCEV_TestVal, const SCEV *SCEV_UpperBound,
DenseMap<BasicBlock *, isl::set> &InvalidDomainMap, bool IsStrictUpperBound,
bool IsInsideDomain) {
// Do not take NonNeg assumption on TestVal
// as it might have MSB (Sign bit) set.
- isl_pw_aff *TestVal = getPwAff(BB, InvalidDomainMap, SCEV_TestVal,
- /*NonNegative=*/false, IsInsideDomain)
- .release();
+ isl::pw_aff TestVal = getPwAff(BB, InvalidDomainMap, SCEV_TestVal,
+ /*NonNegative=*/false, IsInsideDomain);
// Take NonNeg assumption on UpperBound.
- isl_pw_aff *UpperBound = getPwAff(BB, InvalidDomainMap, SCEV_UpperBound,
- /*NonNegative=*/true, IsInsideDomain)
- .release();
+ isl::pw_aff UpperBound = getPwAff(BB, InvalidDomainMap, SCEV_UpperBound,
+ /*NonNegative=*/true, IsInsideDomain);
// 0 <= TestVal
- isl_set *First =
- isl_pw_aff_le_set(isl_pw_aff_zero_on_domain(isl_local_space_from_space(
- isl_pw_aff_get_domain_space(TestVal))),
- isl_pw_aff_copy(TestVal));
+ isl::set First =
+ isl::pw_aff(isl::local_space(TestVal.domain_space())).le_set(TestVal);
- isl_set *Second;
+ isl::set Second;
if (IsStrictUpperBound)
// TestVal < UpperBound
- Second = isl_pw_aff_lt_set(TestVal, UpperBound);
+ Second = TestVal.lt_set(std::move(UpperBound));
else
// TestVal <= UpperBound
- Second = isl_pw_aff_le_set(TestVal, UpperBound);
+ Second = TestVal.le_set(std::move(UpperBound));
- isl_set *ConsequenceCondSet = isl_set_intersect(First, Second);
+ isl::set ConsequenceCondSet = First.intersect(std::move(Second));
return ConsequenceCondSet;
}
@@ -505,23 +501,31 @@ bool ScopBuilder::buildConditionSets(
switch (ICond->getPredicate()) {
case ICmpInst::ICMP_ULT:
ConsequenceCondSet = buildUnsignedConditionSets(
- BB, Condition, Domain, LeftOperand, RightOperand, InvalidDomainMap,
- /*IsStrictUpperBound=*/true, IsInsideDomain);
+ BB, Condition, isl::manage_copy(Domain),
+ LeftOperand, RightOperand, InvalidDomainMap,
+ /*IsStrictUpperBound=*/true, IsInsideDomain)
+ .release();
break;
case ICmpInst::ICMP_ULE:
ConsequenceCondSet = buildUnsignedConditionSets(
- BB, Condition, Domain, LeftOperand, RightOperand, InvalidDomainMap,
- /*IsStrictUpperBound=*/false, IsInsideDomain);
+ BB, Condition, isl::manage_copy(Domain),
+ LeftOperand, RightOperand, InvalidDomainMap,
+ /*IsStrictUpperBound=*/false, IsInsideDomain)
+ .release();
break;
case ICmpInst::ICMP_UGT:
ConsequenceCondSet = buildUnsignedConditionSets(
- BB, Condition, Domain, RightOperand, LeftOperand, InvalidDomainMap,
- /*IsStrictUpperBound=*/true, IsInsideDomain);
+ BB, Condition, isl::manage_copy(Domain),
+ RightOperand, LeftOperand, InvalidDomainMap,
+ /*IsStrictUpperBound=*/true, IsInsideDomain)
+ .release();
break;
case ICmpInst::ICMP_UGE:
ConsequenceCondSet = buildUnsignedConditionSets(
- BB, Condition, Domain, RightOperand, LeftOperand, InvalidDomainMap,
- /*IsStrictUpperBound=*/false, IsInsideDomain);
+ BB, Condition, isl::manage_copy(Domain),
+ RightOperand, LeftOperand, InvalidDomainMap,
+ /*IsStrictUpperBound=*/false, IsInsideDomain)
+ .release();
break;
default:
LHS = getPwAff(BB, InvalidDomainMap, LeftOperand, NonNeg, IsInsideDomain)
More information about the llvm-commits
mailing list