[llvm-commits] [PATCH 07/20] [AVX] Unique BitInit

David Blaikie dblaikie at gmail.com
Tue Jul 19 14:33:52 PDT 2011


> Well, there's a scoping issue there.  It seems to me like not polluting
> the llvm namespace is more beneficial than avoiding some lazy
> initialization that might happen once and probably not ever because
> compiler's aren't that smart.  :)

Actually it's the other way - compilers have to do the lazy init
(though it doesn't have to be thread safe in C++03, probably does have
to be thread safe in C++0x though I haven't checked - there's a fancy
superfast way to do this thread safely, though) unless they're smart
enough to prove it's not necessary (the "as if" clause - static locals
must be initialized on the first call, but if the compiler can prove
that initializing them at some other time will look "as if" it was the
first call, they can do that)

But yes, I'd put it in an anonymous namespace (C++ equivalent of a
c-style file-scoped static, so it doesn't pollute any namespaces) if I
were doing that.

> UnsetInit is the only other one, I think.  I've fixed both.

Cool

- David




More information about the llvm-commits mailing list