Patch RFA: Add option -fcollectible-pointers, use it in ivopts

Ian Lance Taylor iant@golang.org
Fri Jan 22 23:53:00 GMT 2016


On Fri, Jan 22, 2016 at 11:25 AM, Bernd Schmidt <bernds_cb1@t-online.de> wrote:
> On 01/22/2016 08:03 PM, Ian Lance Taylor wrote:
>>
>> Updated patch.
>>
>> I've verified that I'm changing the only relevant place in
>> tree-ssa-loop-ivopts.c that creates a POINTER_PLUS_EXPR, so I do think
>> that this is the only changed to fix the problem for ivopts.
>
>
> I don't think so. One of the problems with ivopts is that it likes to cast
> everything to unsigned int, so looking for POINTER_PLUS_EXPR wouldn't find
> all affected spots. At least this used to happen, I didn't check recently.
> Also, a lot of the generated expressions are built by tree-affine.c rather
> than in ivopts directly.

Thanks for the tip.  I moved the check to add_candidate_1 instead.
This is before the point where it converts to an integer type.  This
approach is better anyhow, as it permits a pointer loop to use an
integer induction variable for the offset.  My tests still pass, as
does bootstrap/testsuite on x86_64-pc-linux-gnu.

Does this look OK for mainline?

Ian


gcc/ChangeLog:

2016-01-22  Ian Lance Taylor  <iant@google.com>

* common.opt (fkeep-gc-roots-live): New option.
* tree-ssa-loop-ivopts.c (add_candidate_1): If
-fkeep-gc-roots-live, skip pointers.
(add_iv_candidate_for_biv): Handle add_candidate_1 returning
NULL.
* doc/invoke.texi (Optimize Options): Document
-fkeep-gc-roots-live.

gcc/testsuite/ChangeLog:

2016-01-22  Ian Lance Taylor  <iant@google.com>

* gcc.dg/tree-ssa/ivopt_5.c: New test.



More information about the Gcc-patches mailing list