Patchwork [tree-optimization] : Fix PR46346

login
register
mail settings
Submitter Uros Bizjak
Date Nov. 7, 2010, 5:58 p.m.
Message ID <AANLkTikjRk_RPhGmdS3CJA00zHBPE+Fdf5RSJvqK91YC@mail.gmail.com>
Download mbox | patch
Permalink /patch/70367/
State New
Headers show

Comments

Uros Bizjak - Nov. 7, 2010, 5:58 p.m.
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  <ubizjak@gmail.com>

	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.

Patch

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)