aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-06-24 10:35:30 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-06-24 10:35:30 +0000
commit997532771156fcc29ded5fba7f5c7ec579311f45 (patch)
tree2567eb04a5099a006aa633fc8767f2961440a5c1
parent56ad0e3820fa6f21e603e83c6e0908d39915463a (diff)
downloadgcc-997532771156fcc29ded5fba7f5c7ec579311f45.zip
gcc-997532771156fcc29ded5fba7f5c7ec579311f45.tar.gz
gcc-997532771156fcc29ded5fba7f5c7ec579311f45.tar.bz2
re PR tree-optimization/61572 (ICE: in assign_by_spills, at lra-assigns.c:1335)
2014-06-24 Richard Biener <rguenther@suse.de> PR tree-optimization/61572 * tree-ssa-sink.c (statement_sink_location): Do not sink loads from hard registers. * gcc.target/i386/pr61572.c: New testcase. From-SVN: r211933
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61572.c46
-rw-r--r--gcc/tree-ssa-sink.c6
4 files changed, 63 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b82e840..15e16bf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/61572
+ * tree-ssa-sink.c (statement_sink_location): Do not sink
+ loads from hard registers.
+
2014-06-24 Jakub Jelinek <jakub@redhat.com>
* gimplify.c (gimplify_omp_for): For #pragma omp for simd iterator
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 279d4ee..9bd9a21 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/61572
+ * gcc.target/i386/pr61572.c: New testcase.
+
2014-06-24 Jakub Jelinek <jakub@redhat.com>
* gfortran.dg/gomp/udr2.f90 (f7, f9): Add !$omp parallel with
diff --git a/gcc/testsuite/gcc.target/i386/pr61572.c b/gcc/testsuite/gcc.target/i386/pr61572.c
new file mode 100644
index 0000000..3456333
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61572.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct autofs_sb_info
+{
+ int exp_timeout;
+};
+void *f;
+int g;
+static int fn1 (struct autofs_sb_info *p1)
+{
+ int a, b;
+ a = (
+ {
+ register __typeof__(0) c
+#if defined __x86_64__
+ asm("rdx")
+#endif
+ ;
+ b = c;
+ int d;
+ __typeof__(0) e;
+ e = p1->exp_timeout / 1000;
+ switch (0)
+ default:
+ asm("" : "=a"(d) : "0"(e), ""(0));
+ d;
+ });
+ if (a)
+ return 1;
+ if (b)
+ p1->exp_timeout = 0;
+ return 0;
+}
+
+int fn2 ()
+{
+ struct autofs_sb_info *h = f;
+ switch (g)
+ {
+ case 0 ?:
+0 : return fn1 (h);
+ default:
+ return 0;
+ }
+}
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index f7485ef..fb7310d 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -374,6 +374,12 @@ statement_sink_location (gimple stmt, basic_block frombb,
nearest to commondom. */
if (gimple_vuse (stmt))
{
+ /* Do not sink loads from hard registers. */
+ if (gimple_assign_single_p (stmt)
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == VAR_DECL
+ && DECL_HARD_REGISTER (gimple_assign_rhs1 (stmt)))
+ return false;
+
imm_use_iterator imm_iter;
use_operand_p use_p;
basic_block found = NULL;