From c3e85659f16f012074dc41ac48f520ad2334e589 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Tue, 3 Jan 2012 12:07:18 +0000 Subject: [PATCH] re PR tree-optimization/51070 (ICE verify_gimple failed) 2012-01-03 Richard Guenther PR tree-optimization/51070 * tree-loop-distribution.c (stmt_has_scalar_dependences_outside_loop): Properly handle calls. * gcc.dg/torture/pr51070-2.c: New testcase. From-SVN: r182839 --- gcc/ChangeLog | 6 ++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/torture/pr51070-2.c | 35 ++++++++++++++++++++++++ gcc/tree-loop-distribution.c | 9 ++++-- 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr51070-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 77e96a33595..8c986ab44a4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-01-03 Richard Guenther + + PR tree-optimization/51070 + * tree-loop-distribution.c (stmt_has_scalar_dependences_outside_loop): + Properly handle calls. + 2012-01-03 Richard Guenther PR tree-optimization/51692 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 195630cb5ae..6b7808ab18e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-01-03 Richard Guenther + + PR tree-optimization/51070 + * gcc.dg/torture/pr51070-2.c: New testcase. + 2012-01-03 Richard Guenther PR tree-optimization/51692 diff --git a/gcc/testsuite/gcc.dg/torture/pr51070-2.c b/gcc/testsuite/gcc.dg/torture/pr51070-2.c new file mode 100644 index 00000000000..f21eb3acbd7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr51070-2.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-fno-inline" } */ + +int +func_4 (int si1, int si2) +{ + return si1; +} + +int +func_14 (int left, int right) +{ + return 1; +} + +int +func_37 (int left, int right) +{ + return left; +} + +int g_92[1024]; +int g_95[1024]; +int g_224; +int g_352[1024]; +int +func_9 () +{ + for (; g_224; g_224 += 1) + { + g_95[0] = func_4 (func_37 (g_92[g_224], 0), 0); + g_92[g_224] = 0, g_352[g_224] = func_14 (0, 0); + } + return 0; +} diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 0daef06b954..67c3c4149eb 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -89,8 +89,9 @@ stmt_has_scalar_dependences_outside_loop (gimple stmt) switch (gimple_code (stmt)) { + case GIMPLE_CALL: case GIMPLE_ASSIGN: - name = gimple_assign_lhs (stmt); + name = gimple_get_lhs (stmt); break; case GIMPLE_PHI: @@ -101,8 +102,10 @@ stmt_has_scalar_dependences_outside_loop (gimple stmt) return false; } - return TREE_CODE (name) == SSA_NAME - && ssa_name_has_uses_outside_loop_p (name, loop_containing_stmt (stmt)); + return (name + && TREE_CODE (name) == SSA_NAME + && ssa_name_has_uses_outside_loop_p (name, + loop_containing_stmt (stmt))); } /* Update the PHI nodes of NEW_LOOP. NEW_LOOP is a duplicate of