]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Avoid more temporaries in IVOPTs
authorRichard Biener <rguenther@suse.de>
Wed, 14 Apr 2021 10:48:37 +0000 (12:48 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 23 Apr 2021 08:28:10 +0000 (10:28 +0200)
This avoids use of valid_gimple_rhs_p and instead gimplifies to
such a RHS, avoiding more SSA copies being generated by IVOPTs.

2021-04-14  Richard Biener  <rguenther@suse.de>

* tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Avoid
valid_gimple_rhs_p by instead gimplifying to one.

gcc/tree-ssa-loop-ivopts.c

index 4012ae3f19ddb7ac6e51522ac9db86fd88a7ec04..12a8a49a3071c09f222fbb6aef68c2a24a107252 100644 (file)
@@ -7286,12 +7286,13 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
     }
 
   comp = fold_convert (type, comp);
-  if (!valid_gimple_rhs_p (comp)
-      || (gimple_code (use->stmt) != GIMPLE_PHI
-         /* We can't allow re-allocating the stmt as it might be pointed
-            to still.  */
-         && (get_gimple_rhs_num_ops (TREE_CODE (comp))
-             >= gimple_num_ops (gsi_stmt (bsi)))))
+  comp = force_gimple_operand (comp, &seq, false, NULL);
+  gimple_seq_add_seq (&stmt_list, seq);
+  if (gimple_code (use->stmt) != GIMPLE_PHI
+      /* We can't allow re-allocating the stmt as it might be pointed
+        to still.  */
+      && (get_gimple_rhs_num_ops (TREE_CODE (comp))
+         >= gimple_num_ops (gsi_stmt (bsi))))
     {
       comp = force_gimple_operand (comp, &seq, true, NULL);
       gimple_seq_add_seq (&stmt_list, seq);