compiler: set captured variable address to nonescape until further flooded
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 9 Jan 2018 23:43:23 +0000 (23:43 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 9 Jan 2018 23:43:23 +0000 (23:43 +0000)
    The escape analysis models closures by flowing captured variable
    address to the closure node. However, the escape state for the
    address expressions remained unset as ESCAPE_UNKNOWN. This
    caused later passes to conclude that the address escapes. Fix this by
    setting its escape state to ESCAPE_NONE first. If it escapes
    (because the closure escapes), the flood phase will set its
    escape state properly.

    Reviewed-on: https://go-review.googlesource.com/86240

From-SVN: r256411

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/escape.cc

index 80ccaf3b3b98fa8084e7e2938656447d6d953d02..fc2e65d5259017c7f6c7f9768b4a25b23926ef4a 100644 (file)
@@ -1,4 +1,4 @@
-7c5e4d67041e3529a055a923b2b9f5ef09aa72a3
+bea521d1d8688bea5b14b1ae2a03aec949f48a44
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 65ccf9bd0db015b5d085564f89dd4dafbeef3655..2e9798ea7415d7eb30cebbe2e54f30c5e760972a 100644 (file)
@@ -1774,9 +1774,7 @@ Escape_analysis_assign::expression(Expression** pexpr)
            for (; p != sce->vals()->end(); ++p)
              {
                Node* enclosed_node = Node::make_node(*p);
-               Node::Escape_state* state =
-                 enclosed_node->state(this->context_, NULL);
-               state->loop_depth = this->context_->loop_depth();
+               this->context_->track(enclosed_node);
                this->assign(closure_node, enclosed_node);
              }
          }