From: Vladimir N. Makarov Date: Mon, 16 Mar 2020 20:42:19 +0000 (-0400) Subject: Fix PR94185: Do not reuse insn alternative after changing memory subreg. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=r10-7197-gbae7b38cf8a21e068ad5c0bab089dedb78af3346;p=gcc.git Fix PR94185: Do not reuse insn alternative after changing memory subreg. 2020-03-16 Vladimir Makarov PR target/94185 * lra-spills.c (remove_pseudos): Do not reuse insn alternative after changing memory subreg. 2020-03-16 Vladimir Makarov PR target/94185 * g++.target/i386/pr94185.C: New test. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03ac0d439da..25a27f8070d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-03-16 Vladimir Makarov + + PR target/94185 + * lra-spills.c (remove_pseudos): Do not reuse insn alternative + after changing memory subreg. + 2020-03-16 Andre Vieira Srinath Parvathaneni diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index 01256e711bc..a4b955ac3d4 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -427,7 +427,17 @@ remove_pseudos (rtx *loc, rtx_insn *insn) and avoid LRA cycling in case of subreg memory reload. */ res = remove_pseudos (&SUBREG_REG (*loc), insn); if (GET_CODE (SUBREG_REG (*loc)) == MEM) - alter_subreg (loc, false); + { + alter_subreg (loc, false); + if (GET_CODE (*loc) == MEM) + { + lra_get_insn_recog_data (insn)->used_insn_alternative = -1; + if (lra_dump_file != NULL) + fprintf (lra_dump_file, + "Memory subreg was simplified in in insn #%u\n", + INSN_UID (insn)); + } + } return res; } else if (code == REG && (i = REGNO (*loc)) >= FIRST_PSEUDO_REGISTER diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c3d6eccea0c..3b277cecac3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-03-16 Vladimir Makarov + + PR target/94185 + * g++.target/i386/pr94185.C: New test. + 2020-03-16 Richard Sandiford * gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: Add a test diff --git a/gcc/testsuite/g++.target/i386/pr94185.C b/gcc/testsuite/g++.target/i386/pr94185.C new file mode 100644 index 00000000000..587b7bac6db --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr94185.C @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fPIE -fstack-protector-strong" } */ + +struct a { + int b; + int c(); + a() : b(c()) {} + ~a(); + char *e(); +}; +struct f { + void g(int); +}; +struct ar { + int au[256]; + f h(int); +} bb; +a i(); +a j(int); +long k(int, ar); +int d; +void l(char *, ar m, long n) { + switch (m.au[d]) + case 0: + n &= 4294967295; + bb.h(0).g(n); +} +void o() { + ar bd; + a bh, bi, attrname = j(0) = i(); + int be = k(0, bd); + l(attrname.e(), bd, be); +}