diff mbox series

[1/6] ifcvt: Store the number of created cmovs.

Message ID 20181114130752.5057-2-rdapp@linux.ibm.com
State New
Headers show
Series If conversion with multiple sets. | expand

Commit Message

Robin Dapp Nov. 14, 2018, 1:07 p.m. UTC
This patch saves the number of created conditional moves by
noce_convert_multiple_sets in the IF_INFO struct.  This may be used by
the backend to easier decide whether to accept a generated sequence or
not.

--

gcc/ChangeLog:

2018-11-14  Robin Dapp  <rdapp@linux.ibm.com>

	* ifcvt.c (noce_convert_multiple_sets): Set cmov count.
	(noce_find_if_block): Set cmov count.
	* ifcvt.h (struct noce_if_info): Add cmov count.
---
 gcc/ifcvt.c | 10 ++++++++--
 gcc/ifcvt.h |  4 ++++
 2 files changed, 12 insertions(+), 2 deletions(-)

Comments

Jeff Law Nov. 14, 2018, 8:22 p.m. UTC | #1
On 11/14/18 6:07 AM, Robin Dapp wrote:
> This patch saves the number of created conditional moves by
> noce_convert_multiple_sets in the IF_INFO struct.  This may be used by
> the backend to easier decide whether to accept a generated sequence or
> not.
> 
> --
> 
> gcc/ChangeLog:
> 
> 2018-11-14  Robin Dapp  <rdapp@linux.ibm.com>
> 
> 	* ifcvt.c (noce_convert_multiple_sets): Set cmov count.
> 	(noce_find_if_block): Set cmov count.
> 	* ifcvt.h (struct noce_if_info): Add cmov count.
So this series came in after stage1 close.    I'm not aware of a bug
this series is meant to fix, but perhaps you just didn't include a
reference to it.

Anyway, patches #1 and #3 are OK for the trunk right now.

Jeff
diff mbox series

Patch

diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 8b3907618e7..ddf077fa051 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -3247,9 +3247,14 @@  noce_convert_multiple_sets (struct noce_if_info *if_info)
   /* Actually emit the sequence if it isn't too expensive.  */
   rtx_insn *seq = get_insns ();
 
+  if_info->transform_name = "noce_convert_multiple_sets";
+  if_info->created_cmovs = count;
+
   if (!targetm.noce_conversion_profitable_p (seq, if_info))
     {
       end_sequence ();
+      if_info->transform_name = "";
+      if_info->created_cmovs = 0;
       return FALSE;
     }
 
@@ -3296,7 +3301,7 @@  noce_convert_multiple_sets (struct noce_if_info *if_info)
     }
 
   num_updated_if_blocks++;
-  if_info->transform_name = "noce_convert_multiple_sets";
+
   return TRUE;
 }
 
@@ -4060,7 +4065,8 @@  noce_find_if_block (basic_block test_bb, edge then_edge, edge else_edge,
      and jump_insns are always given a cost of 1 by seq_cost, so treat
      both instructions as having cost COSTS_N_INSNS (1).  */
   if_info.original_cost = COSTS_N_INSNS (2);
-
+  if_info.transform_name = "";
+  if_info.created_cmovs = 0;
 
   /* Do the real work.  */
 
diff --git a/gcc/ifcvt.h b/gcc/ifcvt.h
index a18ba94b8df..50f40bbd1e5 100644
--- a/gcc/ifcvt.h
+++ b/gcc/ifcvt.h
@@ -108,6 +108,10 @@  struct noce_if_info
   /* The name of the noce transform that succeeded in if-converting
      this structure.  Used for debugging.  */
   const char *transform_name;
+
+  /* The number of created conditional moves in case we convert multiple
+     sets.  */
+  unsigned int created_cmovs;
 };
 
 #endif /* GCC_IFCVT_H */