aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2016-11-02 09:25:22 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2016-11-02 09:25:22 +0000
commit63e523d6f0853765adc332c7a68a8e6b16971d6b (patch)
treeaedc40b214eadb2e102ee0d7a959c8b882146450 /gcc
parent04ddfe064b58a9ce69a332942d51722dfb13db66 (diff)
downloadgcc-63e523d6f0853765adc332c7a68a8e6b16971d6b.zip
gcc-63e523d6f0853765adc332c7a68a8e6b16971d6b.tar.gz
gcc-63e523d6f0853765adc332c7a68a8e6b16971d6b.tar.bz2
PR tree-optimization/78162: Reject negative offsets in store merging early
PR tree-optimization/78162 * gimple-ssa-store-merging.c (execute): Mark stores with bitpos < 0 as invalid. * gcc.c-torture/compile/pr78162.c: New test. From-SVN: r241778
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimple-ssa-store-merging.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr78162.c10
4 files changed, 22 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 52215f6..aee2b83 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2016-11-02 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+ PR tree-optimization/78162
+ * gimple-ssa-store-merging.c (execute): Mark stores with bitpos < 0
+ as invalid.
+
+2016-11-02 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
* config/aarch64/aarch64.c (aarch64_register_saved_on_entry): Add
function comment.
(aarch64_next_callee_save): Likewise.
diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index 97af141..feba907 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -1361,7 +1361,7 @@ pass_store_merging::execute (function *fun)
&unsignedp, &reversep, &volatilep);
/* As a future enhancement we could handle stores with the same
base and offset. */
- bool invalid = offset || reversep
+ bool invalid = offset || reversep || bitpos < 0
|| ((bitsize > MAX_BITSIZE_MODE_ANY_INT)
&& (TREE_CODE (rhs) != INTEGER_CST))
|| !rhs_valid_for_store_merging_p (rhs)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6827c00..d979a56 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-02 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR tree-optimization/78162
+ * gcc.c-torture/compile/pr78162.c: New test.
+
2016-11-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/78035
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78162.c b/gcc/testsuite/gcc.c-torture/compile/pr78162.c
new file mode 100644
index 0000000..743d4e6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr78162.c
@@ -0,0 +1,10 @@
+/* PR tree-optimization/78162.
+ Handle negative offsets in store merging gracefully. */
+
+int a, b[1][2];
+
+void fn1()
+{
+ for (a = 0; a < 2; a++)
+ b[-1][a] = 0;
+}