Optimize callers using nonnull attribute

Jeff Law law@redhat.com
Tue Oct 8 04:33:00 GMT 2013


On 10/07/13 07:52, Marc Glisse wrote:
> On Mon, 7 Oct 2013, Richard Biener wrote:
>
>> On Mon, Oct 7, 2013 at 12:33 AM, Marc Glisse <marc.glisse@inria.fr>
>> wrote:
>>> Hello,
>>>
>>> this patch asserts that when we call a function with the nonnull
>>> attribute,
>>> the corresponding argument is not zero, just like when we dereference a
>>> pointer. Everything is under a check for
>>> flag_delete_null_pointer_checks.
>>>
>>> Note that this function currently gives up if the statement may throw
>>> (because in some languages indirections may throw?), but this could
>>> probably
>>> be relaxed a bit so my example would still work when compiled with g++,
>>> without having to mark f1 and f2 as throw().
>>>
>>> Bootstrap (default languages) + testsuite on x86_64-unknown-linux-gnu.
>>
>> Can you please restructure it in a way to not require a goto?  That is,
>> move searching for a non-null opportunity into a helper function?
>
> Thanks. I wasn't sure what to put in the helper and what to keep in the
> original function, so I'll wait a bit for comments before the commit.
>
> Bootstrap (default languages) + testsuite on x86_64-unknown-linux-gnu.
I like it.  Tweak per Richi's suggestion to avoid the goto and get it 
committed!

jeff



More information about the Gcc-patches mailing list