aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-06-16 09:11:37 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-06-16 09:11:37 +0200
commit67c2581668b93baed8e5b5e678656ce3ff306413 (patch)
tree0b04943e88b5c999735334d10b33e213d9b3661e /gcc
parentb189112fbbeeda82551fd71251728c107f2eeec5 (diff)
downloadgcc-67c2581668b93baed8e5b5e678656ce3ff306413.zip
gcc-67c2581668b93baed8e5b5e678656ce3ff306413.tar.gz
gcc-67c2581668b93baed8e5b5e678656ce3ff306413.tar.bz2
re PR rtl-optimization/71532 (FAIL: gfortran.dg/select_char_1.f90 -O2 execution test)
PR rtl-optimization/71532 * cse.c (cse_insn): For const/pure calls, invalidate argument passing memory slots. * gcc.dg/torture/pr71532.c: New test. From-SVN: r237503
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cse.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr71532.c39
4 files changed, 57 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2650405..0ffb38c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/71532
+ * cse.c (cse_insn): For const/pure calls, invalidate argument passing
+ memory slots.
+
2016-06-15 Michael Meissner <meissner@linux.vnet.ibm.com>
* config/rs6000/vsx.md (VSINT_84): Add DImode to enable loading
diff --git a/gcc/cse.c b/gcc/cse.c
index bce4fb0..3b4cc96 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5751,6 +5751,13 @@ cse_insn (rtx_insn *insn)
{
if (!(RTL_CONST_OR_PURE_CALL_P (insn)))
invalidate_memory ();
+ else
+ /* For const/pure calls, invalidate any argument slots, because
+ those are owned by the callee. */
+ for (tem = CALL_INSN_FUNCTION_USAGE (insn); tem; tem = XEXP (tem, 1))
+ if (GET_CODE (XEXP (tem, 0)) == USE
+ && MEM_P (XEXP (XEXP (tem, 0), 0)))
+ invalidate (XEXP (XEXP (tem, 0), 0), VOIDmode);
invalidate_for_call ();
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index be12713..7362ecc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/71532
+ * gcc.dg/torture/pr71532.c: New test.
+
2016-06-15 Michael Meissner <meissner@linux.vnet.ibm.com>
* gcc.target/powerpc/p9-dimode1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr71532.c b/gcc/testsuite/gcc.dg/torture/pr71532.c
new file mode 100644
index 0000000..b10414f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr71532.c
@@ -0,0 +1,39 @@
+/* PR rtl-optimization/71532 */
+/* { dg-do run } */
+/* { dg-additional-options "-mtune=slm" { target i?86-*-* x86_64-*-* } } */
+
+__attribute__((noinline, noclone, pure)) int
+foo (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l)
+{
+ a++; b++; c++; d++; e++; f++; g++; h++; i++; j++; k++; l++;
+ asm volatile ("" : : "g" (&a), "g" (&b), "g" (&c), "g" (&d) : "memory");
+ asm volatile ("" : : "g" (&e), "g" (&f), "g" (&g), "g" (&h) : "memory");
+ asm volatile ("" : : "g" (&i), "g" (&j), "g" (&k), "g" (&l) : "memory");
+ return a + b + c + d + e + f + g + h + i + j + k + l;
+}
+
+__attribute__((noinline, noclone, pure)) int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l)
+{
+ a++; b++; c++; d++; e++; f++; g++; h++; i++; j++; k++; l++;
+ asm volatile ("" : : "g" (&a), "g" (&b), "g" (&c), "g" (&d) : "memory");
+ asm volatile ("" : : "g" (&e), "g" (&f), "g" (&g), "g" (&h) : "memory");
+ asm volatile ("" : : "g" (&i), "g" (&j), "g" (&k), "g" (&l) : "memory");
+ return 2 * a + b + c + d + e + f + g + h + i + j + k + l;
+}
+
+__attribute__((noinline, noclone)) int
+test ()
+{
+ int a = foo (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+ a += bar (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
+ return a;
+}
+
+int
+main ()
+{
+ if (test () != 182)
+ __builtin_abort ();
+ return 0;
+}