Commit 66286a53 by Ian Lance Taylor

compiler: Mark non-escaping variables that aren't addressed.

When optimizing allocations, only variables that had their address
taken somewhere in the program were marked as non-escaping.
There are several cases where non-addressed variables might cause
extra allocations.

From-SVN: r222640
parent fb0cb7fa
...@@ -1560,8 +1560,7 @@ Optimize_allocations::variable(Named_object* var) ...@@ -1560,8 +1560,7 @@ Optimize_allocations::variable(Named_object* var)
if (var->is_variable()) if (var->is_variable())
{ {
if (var->var_value()->is_address_taken()) var->var_value()->set_does_not_escape();
var->var_value()->set_does_not_escape();
if (var->var_value()->init() != NULL if (var->var_value()->init() != NULL
&& var->var_value()->init()->allocation_expression() != NULL) && var->var_value()->init()->allocation_expression() != NULL)
{ {
...@@ -1570,9 +1569,6 @@ Optimize_allocations::variable(Named_object* var) ...@@ -1570,9 +1569,6 @@ Optimize_allocations::variable(Named_object* var)
alloc->set_allocate_on_stack(); alloc->set_allocate_on_stack();
} }
} }
else if (var->is_result_variable()
&& var->result_var_value()->is_address_taken())
var->result_var_value()->set_does_not_escape();
return TRAVERSE_CONTINUE; return TRAVERSE_CONTINUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment