public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Small fix for ifcvt
@ 2010-10-14 19:30 Jakub Jelinek
  2010-10-14 20:07 ` Diego Novillo
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2010-10-14 19:30 UTC (permalink / raw)
  To: gcc-patches

Hi!

If a _Bool SSA_NAME != boolean_false_node condition is fold_build2_loc'ed
into the SSA_NAME itself, invert_truthvalue_loc for it is TRUTH_NOT_EXPR <SSA_NAME>,
which is not a valid condition, so add_to_dst_predicate_list forces it into
queued stmts and then uses the new temporary as the condition.  We end up
then
with D.12346_679 = !D.12345_678 and/or D.12347_680 = D.12345_678 || D.12346_679
useless statements in the basic block, which prevent further vectorization.
By canonicalization of the condition to SSA_NAME == boolean_false_node
we can avoid emitting those useless stmts.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2010-10-14  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/46008
	* tree-if-conv.c (predicate_bbs): Try to canonicalize c2
	if possible.

--- gcc/tree-if-conv.c.jj	2010-09-06 08:42:00.000000000 +0200
+++ gcc/tree-if-conv.c	2010-10-13 17:49:58.000000000 +0200
@@ -915,7 +915,7 @@ predicate_bbs (loop_p loop)
 
 	    case GIMPLE_COND:
 	      {
-		tree c2;
+		tree c2, tem;
 		edge true_edge, false_edge;
 		location_t loc = gimple_location (stmt);
 		tree c = fold_build2_loc (loc, gimple_cond_code (stmt),
@@ -932,6 +932,9 @@ predicate_bbs (loop_p loop)
 
 		/* If C is false, then FALSE_EDGE is taken.  */
 		c2 = invert_truthvalue_loc (loc, unshare_expr (c));
+		tem = canonicalize_cond_expr_cond (c2);
+		if (tem)
+		  c2 = tem;
 		add_to_dst_predicate_list (loop, false_edge, cond, c2);
 
 		cond = NULL_TREE;

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Small fix for ifcvt
  2010-10-14 19:30 [PATCH] Small fix for ifcvt Jakub Jelinek
@ 2010-10-14 20:07 ` Diego Novillo
  0 siblings, 0 replies; 2+ messages in thread
From: Diego Novillo @ 2010-10-14 20:07 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Thu, Oct 14, 2010 at 15:23, Jakub Jelinek <jakub@redhat.com> wrote:

> 2010-10-14  Jakub Jelinek  <jakub@redhat.com>
>
>        PR tree-optimization/46008
>        * tree-if-conv.c (predicate_bbs): Try to canonicalize c2
>        if possible.

OK.

Diego.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-14 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-14 19:30 [PATCH] Small fix for ifcvt Jakub Jelinek
2010-10-14 20:07 ` Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).