X-Git-Url: http://nitlanguage.org diff --git a/src/ssa.nit b/src/ssa.nit index eeeb560..dbaac2e 100644 --- a/src/ssa.nit +++ b/src/ssa.nit @@ -706,7 +706,7 @@ redef class AAssertExpr self.n_else.generate_basic_blocks(ssa, block_false) else block_false.first = self - block_false.first = self + block_false.last = self end old_block.link(block_false) @@ -1076,13 +1076,15 @@ redef class AWhileExpr old_block.link(block) self.n_expr.generate_basic_blocks(ssa, old_block) - var inside_block = self.n_block.generate_basic_blocks(ssa, block) + self.n_block.generate_basic_blocks(ssa, block) # Link the inside of the block to the previous block block.link_special(old_block) # Create a new Block after the while var new_block = new BasicBlock + new_block.first = self + new_block.last = self new_block.need_update = true old_block.link_special(new_block) @@ -1115,15 +1117,17 @@ redef class AForExpr # The beginning of the block is the first instruction var block = new BasicBlock - block.first = self.n_expr + block.first = self.n_groups.first.n_expr block.last = self.n_block.as(not null) - # Visit the test of the if - self.n_expr.generate_basic_blocks(ssa, block) + for g in n_groups do + # Visit the test of the if + g.n_expr.generate_basic_blocks(ssa, block) - # Collect the variables declared in the for - for v in variables do - ssa.propdef.variables.add(v) + # Collect the variables declared in the for + for v in g.variables do + ssa.propdef.variables.add(v) + end end old_block.link(block) @@ -1131,6 +1135,9 @@ redef class AForExpr block.link(old_block) var new_block = new BasicBlock + new_block.first = self + new_block.last = self + new_block.need_update = true return new_block