Skip to content
Snippets Groups Projects
Commit 1ff1469c authored by Martin Bauer's avatar Martin Bauer
Browse files

Merge branch 'cbackend_conditional' into 'master'

cbackend: short-cut _print_Conditional if condition is a boolean atom

See merge request !89
parents a723120e f1fc341a
Branches
Tags
1 merge request!89cbackend: short-cut _print_Conditional if condition is a boolean atom
Pipeline #19962 passed with stages
in 7 minutes and 23 seconds
...@@ -292,6 +292,10 @@ class CBackend: ...@@ -292,6 +292,10 @@ class CBackend:
return "" return ""
def _print_Conditional(self, node): def _print_Conditional(self, node):
if type(node.condition_expr) is sp.boolalg.BooleanTrue:
return self._print_Block(node.true_block)
elif type(node.condition_expr) is sp.boolalg.BooleanFalse:
return self._print_Block(node.false_block)
cond_type = get_type_of_expression(node.condition_expr) cond_type = get_type_of_expression(node.condition_expr)
if isinstance(cond_type, VectorType): if isinstance(cond_type, VectorType):
raise ValueError("Problem with Conditional inside vectorized loop - use vec_any or vec_all") raise ValueError("Problem with Conditional inside vectorized loop - use vec_any or vec_all")
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment