Skip to content
Snippets Groups Projects

Eliminate branches: implement isl analysis and recurse into conditionals

Merged Daniel Bauer requested to merge hyteg/pystencils:bauerd/isl into backend-rework
All threads resolved!
Viewing commit f4ddc15e
Show latest version
1 file
+ 5
2
Preferences
Compare changes
@@ -109,7 +109,7 @@ class EliminateBranches:
@@ -109,7 +109,7 @@ class EliminateBranches:
self, conditional: PsConditional, ec: BranchElimContext
self, conditional: PsConditional, ec: BranchElimContext
) -> PsConditional | PsBlock | None:
) -> PsConditional | PsBlock | None:
condition_simplified = self._elim_constants(conditional.condition)
condition_simplified = self._elim_constants(conditional.condition)
if not self.no_isl:
if not self._no_isl:
condition_simplified = self._isl_symplify_condition(
condition_simplified = self._isl_symplify_condition(
condition_simplified, ec
condition_simplified, ec
)
)
@@ -125,7 +125,10 @@ class EliminateBranches:
@@ -125,7 +125,10 @@ class EliminateBranches:
def _isl_symplify_condition(
def _isl_symplify_condition(
self, condition: PsExpression, ec: BranchElimContext
self, condition: PsExpression, ec: BranchElimContext
) -> PsExpression:
) -> PsExpression:
"""Transformations using integer sets based on ISL library"""
"""If installed, use ISL to simplify the passed condition to true or
 
false based on enclosing loops and conditionals. If no simplification
 
can be made or ISL is not installed, the original condition is returned.
 
"""
try:
try:
import islpy as isl
import islpy as isl