aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-10-07 17:47:45 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-10-07 17:47:45 +0000
commit65f52d9af65ab48835d9e40c866c121f2569fb01 (patch)
tree165e79eddcc63188b2d2b34fcdb206e8d4a23625 /gcc/go
parentcba9c7897755fe9f7343d5428b12eea53c98b94e (diff)
downloadgcc-65f52d9af65ab48835d9e40c866c121f2569fb01.zip
gcc-65f52d9af65ab48835d9e40c866c121f2569fb01.tar.gz
gcc-65f52d9af65ab48835d9e40c866c121f2569fb01.tar.bz2
compiler: Don't make temporaries for constant operands.
Fixes golang/go#12616. Reviewed-on: https://go-review.googlesource.com/14645 From-SVN: r228578
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc4
2 files changed, 3 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 19dcf2a..dda0032 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -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.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 56bbf61..80f8b4c 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -5200,13 +5200,13 @@ Binary_expression::do_flatten(Gogo* gogo, Named_object*,
|| (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);