mirror of https://github.com/m-labs/artiq.git
transforms.cfg_simplifier: correctly update phis.
This commit is contained in:
parent
2a474b7166
commit
72b6cca9c3
|
@ -26,7 +26,10 @@ class CFGSimplifier:
|
||||||
# Our IR doesn't tolerate branch_if %c, %b, %b
|
# Our IR doesn't tolerate branch_if %c, %b, %b
|
||||||
insn.replace_with(ir.Branch(successor))
|
insn.replace_with(ir.Branch(successor))
|
||||||
elif isinstance(insn, ir.Phi):
|
elif isinstance(insn, ir.Phi):
|
||||||
|
incoming_value = insn.incoming_value_for_block(block)
|
||||||
insn.remove_incoming_block(block)
|
insn.remove_incoming_block(block)
|
||||||
|
for pred in block.predecessors():
|
||||||
|
insn.add_incoming(incoming_value, pred)
|
||||||
|
|
||||||
block.replace_all_uses_with(successor)
|
block.replace_all_uses_with(successor)
|
||||||
block.erase()
|
block.erase()
|
||||||
|
|
Loading…
Reference in New Issue