gccgo patch committed: If unary & does not escape, variable does not escape
Ian Lance Taylor
iant@golang.org
Tue May 12 22:17:00 GMT 2015
This patch to the Go frontend notes that if a unary & of a variable
was marked as not escaping, then we don't need to set it to be
escaping based on the variable. Bootstrapped and ran ran Go testsuite
on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
-------------- next part --------------
diff -r d50f4d14cfec go/expressions.cc
--- a/go/expressions.cc Mon May 11 09:18:03 2015 -0700
+++ b/go/expressions.cc Tue May 12 15:07:53 2015 -0700
@@ -3668,7 +3668,12 @@
if (this->op_ == OPERATOR_AND)
{
- if (this->expr_->var_expression() != NULL)
+ // If this->escapes_ is false at this point, then it was set to
+ // false by an explicit call to set_does_not_escape, and the
+ // value does not escape. If this->escapes_ is true, we may be
+ // able to set it to false if taking the address of a variable
+ // that does not escape.
+ if (this->escapes_ && this->expr_->var_expression() != NULL)
{
Named_object* var = this->expr_->var_expression()->named_object();
if (var->is_variable())
More information about the Gcc-patches
mailing list