]> granicus.if.org Git - clang/commitdiff
[AST] APValue: Split the fast path of MakeUninit to be inline.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 20:28:55 +0000 (20:28 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 20:28:55 +0000 (20:28 +0000)
 - 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

include/clang/AST/APValue.h
lib/AST/APValue.cpp

index f687fb7beb2b10d585e8cc0bc51d1089b5f7941a..b7e588fba4525901c8a02ac39ab79f37435a0f57 100644 (file)
@@ -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);
index 4e17d3b69ebf6b3519245d0824fbde1997bc4d49..976629cea2daf5a18b940ffd96a1ac3aaba773e8 100644 (file)
@@ -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)