From 95c03b3683344ffe73b8116412045ad955a9e2a0 Mon Sep 17 00:00:00 2001 From: Joern Rennecke Date: Fri, 3 May 2013 11:18:37 +0000 Subject: re PR tree-optimization/57027 (ICE in gimple_assign_rhs_code, at gimple.h:2022) 2013-05-03 Joern Rennecke 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. From-SVN: r198577 --- gcc/tree-ssa-math-opts.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa-math-opts.c') 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. */ -- cgit v1.1