This patch to the Go frontend 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] Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 279956) +++ gcc/go/gofrontend/MERGE (working copy) @@ -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. Index: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (revision 279956) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -183,6 +183,24 @@ Expression::is_same_variable(Expression* 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; }