This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ICE in expand_cse_reciprocals (PR tree-optimization/42078, take 2)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: aoliva at gcc dot gnu dot org
- Date: Wed, 18 Nov 2009 18:55:40 +0100
- Subject: [PATCH] Fix ICE in expand_cse_reciprocals (PR tree-optimization/42078, take 2)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Here is the alternative fix for this PR, dropping the debug stmts instead of
creating 1.0 / arg1 temporary.
2009-11-18 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/42078
* tree-ssa-math-opts.c (execute_cse_reciprocals): Drop debug stmts
that are immediate uses of arg1.
* gcc.dg/pr42078.c: New test.
--- gcc/tree-ssa-math-opts.c.jj 2009-11-18 15:48:37.000000000 +0100
+++ gcc/tree-ssa-math-opts.c 2009-11-18 18:46:22.000000000 +0100
@@ -568,6 +568,16 @@ execute_cse_reciprocals (void)
FOR_EACH_IMM_USE_STMT (stmt, ui, arg1)
{
+ /* DWARF[234] doesn't support floating point
+ arithmetics, so don't waste time for now to create
+ D#N = 1.0 / arg1 and replacing all debug stmt arg1
+ uses with D#N. */
+ if (is_gimple_debug (stmt))
+ {
+ gimple_stmt_iterator dgsi = gsi_for_stmt (stmt);
+ gsi_remove (&dgsi, true);
+ continue;
+ }
gimple_assign_set_rhs_code (stmt, MULT_EXPR);
fold_stmt_inplace (stmt);
update_stmt (stmt);
--- gcc/testsuite/gcc.dg/pr42078.c.jj 2009-11-18 14:58:17.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr42078.c 2009-11-18 14:55:54.000000000 +0100
@@ -0,0 +1,22 @@
+/* PR tree-optimization/42078 */
+/* { dg-do compile } */
+/* { dg-options "-g -O -ffast-math" } */
+
+double sqrt (double x);
+
+float
+foo (float x)
+{
+ float y = sqrt (x);
+ return x / y;
+}
+
+float
+bar (float x)
+{
+ float y = sqrt (x);
+ float a = y;
+ float b = y;
+ float c = y;
+ return x / y;
+}
Jakub