Skip to content
Snippets Groups Projects
Commit 177fd7a5 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Remove redundant conditional nodes at code generation time

parent c761cd04
No related branches found
No related tags found
No related merge requests found
......@@ -370,9 +370,14 @@ class UFL2LoopyVisitor(ModifiedTerminalTracker):
try:
evaluated = eval(str(cond))
except:
return prim.If(cond,
self.call(o.ufl_operands[1]),
self.call(o.ufl_operands[2]))
op1 = self.call(o.ufl_operands[1])
op2 = self.call(o.ufl_operands[2])
# This conditional might be redundant!
if op1 == op2:
return op1
return prim.If(cond, op1, op2)
# User code generation time evaluation
if evaluated:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment