From: Daniel Dunbar Date: Thu, 8 Mar 2012 20:28:55 +0000 (+0000) Subject: [AST] APValue: Split the fast path of MakeUninit to be inline. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a8c758868f00b7fbe105ad2b469a289cfc92b6d;p=clang [AST] APValue: Split the fast path of MakeUninit to be inline. - This change seems to be a tiny loss on 403.gcc/combine.c (.2%), but I think it is the right thing to do. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152330 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/APValue.h b/include/clang/AST/APValue.h index f687fb7beb..b7e588fba4 100644 --- a/include/clang/AST/APValue.h +++ b/include/clang/AST/APValue.h @@ -385,7 +385,11 @@ public: const APValue &operator=(const APValue &RHS); private: - void MakeUninit(); + void DestroyDataAndMakeUninit(); + void MakeUninit() { + if (Kind != Uninitialized) + DestroyDataAndMakeUninit(); + } void MakeInt() { assert(isUninit() && "Bad state change"); new ((void*)Data) APSInt(1); diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp index 4e17d3b69e..976629cea2 100644 --- a/lib/AST/APValue.cpp +++ b/lib/AST/APValue.cpp @@ -189,7 +189,7 @@ const APValue &APValue::operator=(const APValue &RHS) { return *this; } -void APValue::MakeUninit() { +void APValue::DestroyDataAndMakeUninit() { if (Kind == Int) ((APSInt*)(char*)Data)->~APSInt(); else if (Kind == Float)