* Go patch committed: Don't make temporaries for constant operands
@ 2015-10-07 17:47 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2015-10-07 17:47 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 260 bytes --]
This patch by Chris Manghane changes the Go frontend to not make
temporaries for constant operands in binary expressions. This fixes
https://golang.org/issue/12616 . Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1308 bytes --]
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 228576)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-651e71a729e5dcbd9dc14c1b59b6eff05bfe3d26
+a4bcd319d98ddc52b3e7d16ec87d92aad868ab05
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc (revision 228306)
+++ gcc/go/gofrontend/expressions.cc (working copy)
@@ -5200,13 +5200,13 @@ Binary_expression::do_flatten(Gogo* gogo
|| (is_idiv_op
&& (gogo->check_divide_by_zero() || gogo->check_divide_overflow())))
{
- if (!this->left_->is_variable())
+ if (!this->left_->is_variable() && !this->left_->is_constant())
{
temp = Statement::make_temporary(NULL, this->left_, loc);
inserter->insert(temp);
this->left_ = Expression::make_temporary_reference(temp, loc);
}
- if (!this->right_->is_variable())
+ if (!this->right_->is_variable() && !this->right_->is_constant())
{
temp =
Statement::make_temporary(NULL, this->right_, loc);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-07 17:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-07 17:47 Go patch committed: Don't make temporaries for constant operands Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).