Skip to content

Commit 67f93a5

Browse files
committed
Revert unneeded changes
1 parent 6aca6c3 commit 67f93a5

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

slither/slithir/utils/ssa.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ def last_name(
345345
LocalIRVariable,
346346
],
347347
init_vars: Dict[str, LocalIRVariable],
348-
new_variables: List[Union[StateIRVariable, LocalIRVariable]],
349348
) -> Union[StateIRVariable, LocalIRVariable,]:
350349
candidates = []
351350
# Todo optimize by creating a variables_ssa_written attribute
@@ -360,9 +359,6 @@ def last_name(
360359
candidates.append(LocalIRVariable(n.variable_declaration))
361360
if var.name in init_vars:
362361
candidates.append(init_vars[var.name])
363-
for v in new_variables:
364-
if v.name == var.name:
365-
candidates.append(v)
366362
assert candidates
367363
return max(candidates, key=lambda v: v.index)
368364

@@ -496,25 +492,9 @@ def fix_phi_rvalues_and_storage_ref(
496492
) -> None:
497493
for ir in node.irs_ssa:
498494
if isinstance(ir, (Phi)) and not ir.rvalues:
499-
# We need to order nodes so that a node with an Assignment operation is first
500-
# as the other node may use the variable assigned
501-
nodes = []
502-
for n in ir.nodes:
503-
assignment = False
504-
for irr in n.irs:
505-
if isinstance(irr, Assignment):
506-
nodes.insert(0, n)
507-
assignment = True
508-
break
509-
if not assignment:
510-
nodes.append(n)
511-
# Keep track of the new variables in this set of nodes. We need to pass it to last_name
512-
# in case a node has an Assignment operation and the following one uses the variable assigned
513-
variables = []
514-
for dst in nodes:
515-
variables.append(
516-
last_name(dst, ir.lvalue, init_local_variables_instances, variables)
517-
)
495+
variables = [
496+
last_name(dst, ir.lvalue, init_local_variables_instances) for dst in ir.nodes
497+
]
518498
ir.rvalues = variables
519499
if isinstance(ir, (Phi, PhiCallback)):
520500
if isinstance(ir.lvalue, LocalIRVariable):

0 commit comments

Comments
 (0)