PATCH: Do not call uses_template_parms() unless necessary

Geoffrey Keating geoffk@apple.com
Tue Apr 15 18:11:00 GMT 2003


On Tuesday, April 15, 2003, at 10:58  AM, Mark Mitchell wrote:

> On Tue, 2003-04-15 at 10:48, Geoffrey Keating wrote:
>>
>> On Tuesday, April 15, 2003, at 09:39  AM, Mark Mitchell wrote:
>>
>>> On Mon, 2003-04-14 at 17:31, Ziemowit Laski wrote:
>>>> This super-trivial patch has been pre-approved by Geoff; I will
>>>> place it in 3.3 and mainline.
>>>
>>> Not without a test case you won't. :-)
>>
>> It's a very small speed improvement (it also helps for objective-C++).
>
> Oh, I thought it was a correctness thing.
>
> If it's a speed improvement, it needs a comment.
>
> And if we're going to start factoring NULL tests out of functions to
> avoid function call overhead, the the right way to do that is:
>
>   bool predicate_f (tree);
>
>   #define predicate(T) ((T) ? predicate_f ((T)) : false)
>
> or the equivalent version with an inline function.
>
> We may as well take these wins everywhere, and keep the code tidy, then
> spread this stuff out all over the place.
>
> Otherwise, there's high likelihood I will rip that out the next time I
> encounter it, as soon as I notice it's redundant with the body of the
> function.

Apparently, this is the only place in the cp frontend where this 
function might be called with a NULL value.  (I'm not too worried about 
anyone suddenly noticing the test is redundant, it took me several 
minutes to trace the code flow to be sure that in fact the patch was 
safe.)

-- 
Geoff Keating <geoffk@apple.com>



More information about the Gcc-patches mailing list