Committed: fix PR tree-optimization/57027
Joern Rennecke
joern.rennecke@embecosm.com
Fri May 3 11:23:00 GMT 2013
Bootstrapped & regtested on i686-pc-linux-gnu.
Committed, as reviewed by Richard Biener:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57027
and also arguably obvious.
-------------- next part --------------
2013-05-03 Joern Rennecke <joern.rennecke@embecosm.com>
PR tree-optimization/57027
* tree-ssa-math-opts.c (convert_mult_to_fma): When checking for
fnms opportunity, check we got the prerequisite kind of tree / gimple
before using accessor functions.
Index: tree-ssa-math-opts.c
===================================================================
--- tree-ssa-math-opts.c (revision 198552)
+++ tree-ssa-math-opts.c (working copy)
@@ -2581,11 +2581,15 @@ convert_mult_to_fma (gimple mul_stmt, tr
&& optab_handler (fnma_optab, TYPE_MODE (type)) != CODE_FOR_nothing)
{
tree rhs2 = gimple_assign_rhs2 (use_stmt);
- gimple stmt2 = SSA_NAME_DEF_STMT (rhs2);
- if (has_single_use (rhs2)
- && gimple_assign_rhs_code (stmt2) == MULT_EXPR)
- return false;
+ if (TREE_CODE (rhs2) == SSA_NAME)
+ {
+ gimple stmt2 = SSA_NAME_DEF_STMT (rhs2);
+ if (has_single_use (rhs2)
+ && is_gimple_assign (stmt2)
+ && gimple_assign_rhs_code (stmt2) == MULT_EXPR)
+ return false;
+ }
}
/* We can't handle a * b + a * b. */
More information about the Gcc-patches
mailing list