diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-04-08 19:28:20 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-04-08 19:28:20 +0200 |
commit | abc0647a4d9f9a7acf0fdf39e9abc2fe39c5948d (patch) | |
tree | b64106d038b8d766e5c9df7c8c18fb5b3de0049b /gcc | |
parent | 1a13c0a284eaa74f40c10f387034173bfe3a426b (diff) | |
download | gcc-abc0647a4d9f9a7acf0fdf39e9abc2fe39c5948d.zip gcc-abc0647a4d9f9a7acf0fdf39e9abc2fe39c5948d.tar.gz gcc-abc0647a4d9f9a7acf0fdf39e9abc2fe39c5948d.tar.bz2 |
re PR middle-end/70593 (Miscompilation of xen starting with r226901)
PR middle-end/70593
* tree-ssa-coalesce.c (build_ssa_conflict_graph): For stmt
with multiple SSA_NAME defs, force the outputs other than first
to be live before calling live_track_process_def on each output.
* gcc.target/i386/pr70593.c: New test.
From-SVN: r234834
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr70593.c | 19 | ||||
-rw-r--r-- | gcc/tree-ssa-coalesce.c | 17 |
4 files changed, 44 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9b36de..fe18079 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2016-04-08 Jakub Jelinek <jakub@redhat.com> + PR middle-end/70593 + * tree-ssa-coalesce.c (build_ssa_conflict_graph): For stmt + with multiple SSA_NAME defs, force the outputs other than first + to be live before calling live_track_process_def on each output. + PR rtl-optimization/70574 * fwprop.c (forward_propagate_and_simplify): Don't add REG_EQUAL note if DF_REF_REG (use) is a paradoxical subreg. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e1f87b3..6e0afb0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-04-08 Jakub Jelinek <jakub@redhat.com> + PR middle-end/70593 + * gcc.target/i386/pr70593.c: New test. + PR rtl-optimization/70574 * gcc.target/i386/avx2-pr70574.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr70593.c b/gcc/testsuite/gcc.target/i386/pr70593.c new file mode 100644 index 0000000..c013683 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70593.c @@ -0,0 +1,19 @@ +/* PR middle-end/70593 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +__attribute__((noinline, noclone)) unsigned long +foo (unsigned x) +{ + unsigned long a, c = x; + asm volatile ("xorl\t%k1, %k1\n\tmovl\t$7, %k0" : "=c" (c), "=a" (a) : "0" (c), "1" (c) : "memory"); + return c; +} + +int +main () +{ + if (foo (3) != 7) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c index 93e1e2e..4b0134d 100644 --- a/gcc/tree-ssa-coalesce.c +++ b/gcc/tree-ssa-coalesce.c @@ -906,6 +906,23 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo) else if (is_gimple_debug (stmt)) continue; + /* For stmts with more than one SSA_NAME definition pretend all the + SSA_NAME outputs but the first one are live at this point, so + that conflicts are added in between all those even when they are + actually not really live after the asm, because expansion might + copy those into pseudos after the asm and if multiple outputs + share the same partition, it might overwrite those that should + be live. E.g. + asm volatile (".." : "=r" (a) : "=r" (b) : "0" (a), "1" (a)); + return a; + See PR70593. */ + bool first = true; + FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_DEF) + if (first) + first = false; + else + live_track_process_use (live, var); + FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_DEF) live_track_process_def (live, var, graph); |