diff mbox

[2/2] Minor refactoring of tree-vect-patterns.c

Message ID CAKOQZ8ziqOLrD=4Uz-fX+zRvgr8nVO5fi3pKu-xxsaYyacWPtQ@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Ian Lance Taylor May 4, 2012, 9 p.m. UTC
On Fri, May 4, 2012 at 5:30 AM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Richard Guenther wrote:
>> On Mon, Apr 30, 2012 at 6:19 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
>> > Hello,
>> >
>> > as a second step in refactoring this patch introduces a routine
>> > vect_find_single_use to determine whether a defining statement
>> > has one single use within the current vectorization domain.
>> >
>> > The helper is then called wherever that check is currently
>> > open-coded. =A0There should be no change in behaviour.
>> >
>> > Tested on i386-linux-gnu and arm-linux-gnueabi with no regressions.
>> >
>> > OK for mainline?
>>
>> You can use single_imm_use to avoid the loop and simplify the factored
>> routine.
>>
>> Ok with that change.
>
> I've checked in the version appended below.
>
> ChangeLog:
>
>        * tree-vect-patterns.c (vect_single_imm_use): New function.
>        (vect_recog_widen_mult_pattern): Use it instead of open-coding loop.
>        (vect_recog_over_widening_pattern): Likewise.
>        (vect_recog_widen_shift_pattern): Likewise.

It looks like you checked in a version of this patch to gcc-4_7-branch.
However, the version you committed used "false" where it should have
used "NULL", causing a bootstrap failure in stage 2 when not using building
in release mode:

../../gccgo-gcc/gcc/tree-vect-patterns.c: In function
‘gimple_statement_d* vect_single_imm_use(gimple)’:
../../gccgo-gcc/gcc/tree-vect-patterns.c:104:12: error: converting
‘false’ to pointer type ‘gimple’ [-Werror=conversion-null]
../../gccgo-gcc/gcc/tree-vect-patterns.c:107:12: error: converting
‘false’ to pointer type ‘gimple’ [-Werror=conversion-null]

I committed the appended patch to fix this problem.  Please double-check
the code to make sure it is correct.  Thanks.

Patch bootstrapped on x86_64-unknown-linux-gnu but not tested.  Committed
to 4.7 branch as obvious.

Ian


2012-05-04  Ian Lance Taylor  <iant@google.com>

	* tree-vect-patterns.c (vect_single_imm_use): Correct return
	values from false to NULL.
diff mbox

Patch

Index: gcc/tree-vect-patterns.c
===================================================================
--- gcc/tree-vect-patterns.c	(revision 187181)
+++ gcc/tree-vect-patterns.c	(working copy)
@@ -101,10 +101,10 @@  vect_single_imm_use (gimple def_stmt)
     return NULL;

   if (!gimple_bb (use_stmt))
-    return false;
+    return NULL;

   if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)))
-    return false;
+    return NULL;

   gcc_assert (vinfo_for_stmt (use_stmt));
   return use_stmt;