diff mbox

Go patch committed: Mark non-escaping variables whose address is not taken

Message ID CAOyqgcXmOw51Xd8Nqk06AC6_Gb9HEFEeF2THUwhr-PK8fJJhRw@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor April 30, 2015, 5:21 p.m. UTC
This patch from Chris Manghane marks variables whose address is not
taken as not escaping.  This is needed because for some types there
are ways for the variable to escape even without taking its address.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian
diff mbox

Patch

diff -r c8ad01075b29 go/escape.cc
--- a/go/escape.cc	Wed Apr 29 15:39:43 2015 -0700
+++ b/go/escape.cc	Thu Apr 30 10:20:47 2015 -0700
@@ -1560,8 +1560,7 @@ 
 
   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
 	  && var->var_value()->init()->allocation_expression() != NULL)
 	{
@@ -1570,9 +1569,6 @@ 
 	  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;
 }