This fixes PR57000 by updating virtual SSA form if necessary. Tested on x86_64-unknown-linux-gnu, applied.
Richard. 2013-04-19 Richard Biener <rguent...@suse.de> PR tree-optimization/57000 * tree-ssa-reassoc.c (pass_reassoc): Add TODO_update_ssa_only_virtuals. * gcc.dg/tree-ssa/reassoc-27.c: New testcase. Index: gcc/tree-ssa-reassoc.c =================================================================== *** gcc/tree-ssa-reassoc.c (revision 198085) --- gcc/tree-ssa-reassoc.c (working copy) *************** struct gimple_opt_pass pass_reassoc = *** 4293,4298 **** 0, /* properties_destroyed */ 0, /* todo_flags_start */ TODO_verify_ssa ! | TODO_verify_flow /* todo_flags_finish */ } }; --- 4293,4299 ---- 0, /* properties_destroyed */ 0, /* todo_flags_start */ TODO_verify_ssa ! | TODO_update_ssa_only_virtuals ! | TODO_verify_flow /* todo_flags_finish */ } }; Index: gcc/testsuite/gcc.dg/tree-ssa/reassoc-27.c =================================================================== *** gcc/testsuite/gcc.dg/tree-ssa/reassoc-27.c (revision 0) --- gcc/testsuite/gcc.dg/tree-ssa/reassoc-27.c (working copy) *************** *** 0 **** --- 1,11 ---- + /* { dg-do compile } */ + /* { dg-options "-O -ffast-math -frounding-math -fdump-tree-optimized" } */ + + double baz (double foo, double bar) + { + return foo * foo * foo * foo * bar * bar * bar * bar; + } + + /* We should re-associate this as (foo * bar)**3. */ + /* { dg-final { scan-tree-dump-times " \\\* " 3 "optimized" } } */ + /* { dg-final { cleanup-tree-dump "optimized" } } */