From patchwork Sun Nov 7 17:58:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [tree-optimization] : Fix PR46346 Date: Sun, 07 Nov 2010 07:58:15 -0000 From: Uros Bizjak X-Patchwork-Id: 70367 Message-Id: To: gcc-patches@gcc.gnu.org Cc: rdsandiford@googlemail.com, Richard Guenther Hello! Various tests fail with -mfma with: internal compiler error: in rhs_to_tree, at tree-ssa-forwprop.c:352. Attached patch adds missing GIMPLE_TERNARY_RHS handling to rhs_to_tree. 2010-11-07 Uros Bizjak PR tree-optimization/46346 * tree-ssa-forwprop.c (rhs_to_tree): Handle GIMPLE_TERNARY_RHS. Patch was regression tested on x86_64-pc-linux-gnu. Additionally, it fixes ICE on x86 with -mfma, reported in [1]. OK'd by richi in the PR, committed to mainline SVN. [1] http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00665.html Uros. Index: tree-ssa-forwprop.c =================================================================== --- tree-ssa-forwprop.c (revision 166415) +++ tree-ssa-forwprop.c (working copy) @@ -341,7 +341,11 @@ rhs_to_tree (tree type, gimple stmt) { location_t loc = gimple_location (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); - if (get_gimple_rhs_class (code) == GIMPLE_BINARY_RHS) + if (get_gimple_rhs_class (code) == GIMPLE_TERNARY_RHS) + return fold_build3_loc (loc, code, type, gimple_assign_rhs1 (stmt), + gimple_assign_rhs2 (stmt), + gimple_assign_rhs3 (stmt)); + else if (get_gimple_rhs_class (code) == GIMPLE_BINARY_RHS) return fold_build2_loc (loc, code, type, gimple_assign_rhs1 (stmt), gimple_assign_rhs2 (stmt)); else if (get_gimple_rhs_class (code) == GIMPLE_UNARY_RHS)