Patchwork [tree-optimization] : Fix PR46346

mail settings
Submitter Uros Bizjak
Date Nov. 7, 2010, 5:58 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/70367/
State New
Headers show


Uros Bizjak - Nov. 7, 2010, 5:58 p.m.

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.




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)