diff mbox

Go patch committed: Don't lower blocks twice

Message ID mcrobz7yizn.fsf@coign.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Aug. 29, 2011, 10:02 p.m. UTC
The Go frontend was lowering expressions in blocks twice: once the usual
way, and once by traversing all subexpressions of a block statement.
The main effect of this was to waste compilation time.  This patch fixes
it.  Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian
diff mbox

Patch

diff -r 3ce41bff09c7 go/gogo.cc
--- a/go/gogo.cc	Thu Aug 25 16:11:38 2011 -0700
+++ b/go/gogo.cc	Mon Aug 29 14:59:15 2011 -0700
@@ -1268,6 +1268,12 @@ 
 int
 Lower_parse_tree::statement(Block* block, size_t* pindex, Statement* sorig)
 {
+  // Because we explicitly traverse the statement's contents
+  // ourselves, we want to skip block statements here.  There is
+  // nothing to lower in a block statement.
+  if (sorig->is_block_statement())
+    return TRAVERSE_CONTINUE;
+
   Statement_inserter hold_inserter(this->inserter_);
   this->inserter_ = Statement_inserter(block, pindex);