|
@@ -45,7 +45,7 @@ def get_ineligible_local_ids(entry_point):
|
|
|
def construct_ssa_form(entry_point):
|
|
|
"""Converts local variables into SSA form in the graph defined by the given entry point."""
|
|
|
# Build some helper data structures.
|
|
|
- all_blocks = cfg_ir.get_all_blocks(entry_point)
|
|
|
+ all_blocks = list(cfg_ir.get_all_blocks(entry_point))
|
|
|
ineligible_locals = get_ineligible_local_ids(entry_point)
|
|
|
predecessor_map = cfg_ir.get_all_predecessor_blocks(entry_point)
|
|
|
|
|
@@ -134,6 +134,9 @@ class SSAConstructionState(object):
|
|
|
if trivial_phi_val is None:
|
|
|
return phi_def
|
|
|
else:
|
|
|
+ for pred in self.predecessor_map[phi_def.block]:
|
|
|
+ del self.extra_phi_operands[pred][phi_def]
|
|
|
+
|
|
|
phi_def.block.remove_parameter(phi_def)
|
|
|
phi_def.redefine(trivial_phi_val)
|
|
|
phi_def.block.prepend_definition(phi_def)
|
|
@@ -216,7 +219,7 @@ class SSAConstructionState(object):
|
|
|
# Find all pairs phis which are defined in the branch target block.
|
|
|
applicable_pairs = [
|
|
|
(phi_def, operand_def)
|
|
|
- for phi_def, operand_def in self.extra_phi_operands[block]
|
|
|
+ for phi_def, operand_def in self.extra_phi_operands[block].items()
|
|
|
if phi_def.block == branch.block]
|
|
|
|
|
|
if len(applicable_pairs) == 0:
|