From: Kyrylo Tkachov <[email protected]>

noce_convert_multiple_sets decodes the jump condition with
noce_get_condition and then calls noce_convert_multiple_sets_1 twice, each
call decoding the very same condition again into a cond_earliest local that
it never reads.  Pass the already-decoded condition into the helper and drop
the repeated decode and the dead local.  No functional change.

gcc/ChangeLog:

        * ifcvt.cc (noce_convert_multiple_sets_1): Take the condition as a
        parameter instead of re-decoding it.  Remove the unused cond_earliest
        local.
        (noce_convert_multiple_sets): Pass the decoded condition down.

Signed-off-by: Kyrylo Tkachov <[email protected]>
---
 gcc/ifcvt.cc | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc
index 6d4ebb70656..0a2e60bce23 100644
--- a/gcc/ifcvt.cc
+++ b/gcc/ifcvt.cc
@@ -111,7 +111,7 @@ static void noce_emit_move_insn (rtx, rtx);
 static rtx_insn *block_has_only_trap (basic_block);
 static void init_noce_multiple_sets_info (basic_block,
   auto_delete_vec<noce_multiple_sets_info> &);
-static bool noce_convert_multiple_sets_1 (struct noce_if_info *,
+static bool noce_convert_multiple_sets_1 (noce_if_info *, rtx,
   auto_delete_vec<noce_multiple_sets_info> &,
   auto_delete_vec<noce_multiple_sets_info> &, unsigned,
   const vec<unsigned> &, int *, bool *);
@@ -4193,7 +4193,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
   bool use_cond_earliest = false;
 
   bool ok = noce_convert_multiple_sets_1
-    (if_info, insn_info, else_insn_info, then_count, else_only_indices,
+    (if_info, cond, insn_info, else_insn_info, then_count, else_only_indices,
      &last_needs_comparison, &use_cond_earliest);
   if (!ok)
       return false;
@@ -4206,7 +4206,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
   end_sequence ();
   start_sequence ();
   ok = noce_convert_multiple_sets_1
-    (if_info, insn_info, else_insn_info, then_count, else_only_indices,
+    (if_info, cond, insn_info, else_insn_info, then_count, else_only_indices,
      &last_needs_comparison, &use_cond_earliest);
 
   /* Actually we should not fail anymore if we reached here,
@@ -4304,7 +4304,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
    emitted.  */
 
 static bool
-noce_convert_multiple_sets_1 (struct noce_if_info *if_info,
+noce_convert_multiple_sets_1 (noce_if_info *if_info, rtx cond,
                              auto_delete_vec<noce_multiple_sets_info> 
&insn_info,
                              auto_delete_vec<noce_multiple_sets_info>
                                &else_insn_info,
@@ -4314,10 +4314,6 @@ noce_convert_multiple_sets_1 (struct noce_if_info 
*if_info,
                              bool *use_cond_earliest)
 {
   rtx_insn *jump = if_info->jump;
-  rtx_insn *cond_earliest;
-
-  /* Decompose the condition attached to the jump.  */
-  rtx cond = noce_get_condition (jump, &cond_earliest, false);
 
   rtx cc_cmp = cond_exec_get_condition (jump);
   if (cc_cmp)
-- 
2.50.1 (Apple Git-155)

Reply via email to