[llvm-commits] [PATCH 06/20] [AVX] Unique UnsetInit
Jakob Stoklund Olesen
stoklund at 2pi.dk
Wed Jul 20 08:37:16 PDT 2011
On Jul 19, 2011, at 1:11 PM, David Greene wrote:
> Keep only one UnsetInit around.
> ---
> utils/TableGen/Record.cpp | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git oldutils/TableGen/Record.cpp newutils/TableGen/Record.cpp
> index 3339a22..72b1f5f 100644
> --- oldutils/TableGen/Record.cpp
> +++ newutils/TableGen/Record.cpp
> @@ -397,7 +397,11 @@ RecTy *llvm::resolveTypes(RecTy *T1, RecTy *T2) {
> void Init::dump() const { return print(errs()); }
>
> const UnsetInit *UnsetInit::get() {
> - return new UnsetInit;
> + static const UnsetInit *TheInit = 0;
> + if (TheInit == 0)
> + TheInit = new UnsetInit();
> +
> + return TheInit;
> }
Why use a pointer instead of just a static object?
/jakob
More information about the llvm-commits
mailing list