diff options
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 12 |
2 files changed, 15 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad545ae..5a3de45 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +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. + 2013-05-03 Richard Biener <rguenther@suse.de> * double-int.h (lshift): New overload without precision diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index e7e09f6..a94172d 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -2581,11 +2581,15 @@ convert_mult_to_fma (gimple mul_stmt, tree op1, tree op2) && 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. */ |