[llvm-commits] [PATCH 07/20] [AVX] Unique BitInit
David A. Greene
greened at obbligato.org
Tue Jul 19 13:32:12 PDT 2011
David Blaikie <dblaikie at gmail.com> writes:
>> - return new BitInit(V);
>> + static const BitInit *True = 0;
>> + static const BitInit *False = 0;
>> +
>> + const BitInit **Result = (V ? &True : &False);
>> +
>> + if (*Result == 0)
>> + *Result = new BitInit(V);
>> +
>> + return *Result;
>
> You could use a reference here:
>
> const BitInit &*Result = (V ? True : False);
> if (Result == 0)
> Result = new BitINit(...);
>
> I'm not sure what LLVM's coding conventions are on the use of
> immediate static values rather than lazy initialization, but in this
> case is there a particular reason these are lazy? (if so, a comment
> explaining the necessity, if it's out of character/special, might be
> in order)
I'm not sure what you mean by "lazy." Oh, you mean why aren't they
initialized until needed? I suppose there is no good reason. I
can certainly rework that.
As for references, this is the old C guy in me creeping out. I try to
keep him down as much as possible but he was too wily the other day. :)
-Dave
More information about the llvm-commits
mailing list