aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2020-01-07 15:35:04 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2020-01-07 15:35:04 +0000
commit5561b41dd67630273479d7661638c5c36a5abb5b (patch)
tree779eb268edc81f0bbda25d813a88bdb6a8f95289 /gcc/go/gofrontend
parent0e159efc76324f40c85581af4aca9cd4f0852cc8 (diff)
downloadgcc-5561b41dd67630273479d7661638c5c36a5abb5b.zip
gcc-5561b41dd67630273479d7661638c5c36a5abb5b.tar.gz
gcc-5561b41dd67630273479d7661638c5c36a5abb5b.tar.bz2
compiler: avoid write barrier for a[i] = a[i][:v]
This avoids generating a write barrier for code that appears in the Go1.14beta1 runtime package in (*pageAlloc).sysGrow: s.summary[l] = s.summary[l][:needIdxLimit] Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/213558 From-SVN: r279962
Diffstat (limited to 'gcc/go/gofrontend')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc18
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 6dca40f..9f825da 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-d0a102eea2262e3fca89b1eb342fd03328c4aa16
+86d223eaccecff72b44cd23a014bc028b658055e
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 8d72b1f..c228905 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -183,6 +183,24 @@ Expression::is_same_variable(Expression* a, Expression* b)
bu->operand()));
}
+ Array_index_expression* aie = a->array_index_expression();
+ if (aie != NULL)
+ {
+ Array_index_expression* bie = b->array_index_expression();
+ return (aie->end() == NULL
+ && bie->end() == NULL
+ && Expression::is_same_variable(aie->array(), bie->array())
+ && Expression::is_same_variable(aie->start(), bie->start()));
+ }
+
+ Numeric_constant aval;
+ if (a->numeric_constant_value(&aval))
+ {
+ Numeric_constant bval;
+ if (b->numeric_constant_value(&bval))
+ return aval.equals(bval);
+ }
+
return false;
}