[cfe-commits] r152330 - in /cfe/trunk: include/clang/AST/APValue.h lib/AST/APValue.cpp

Daniel Dunbar daniel at zuster.org
Thu Mar 8 12:28:55 PST 2012


Author: ddunbar
Date: Thu Mar  8 14:28:55 2012
New Revision: 152330

URL: http://llvm.org/viewvc/llvm-project?rev=152330&view=rev
Log:
[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.

Modified:
    cfe/trunk/include/clang/AST/APValue.h
    cfe/trunk/lib/AST/APValue.cpp

Modified: cfe/trunk/include/clang/AST/APValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/APValue.h?rev=152330&r1=152329&r2=152330&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/APValue.h (original)
+++ cfe/trunk/include/clang/AST/APValue.h Thu Mar  8 14:28:55 2012
@@ -385,7 +385,11 @@
   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);

Modified: cfe/trunk/lib/AST/APValue.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/APValue.cpp?rev=152330&r1=152329&r2=152330&view=diff
==============================================================================
--- cfe/trunk/lib/AST/APValue.cpp (original)
+++ cfe/trunk/lib/AST/APValue.cpp Thu Mar  8 14:28:55 2012
@@ -189,7 +189,7 @@
   return *this;
 }
 
-void APValue::MakeUninit() {
+void APValue::DestroyDataAndMakeUninit() {
   if (Kind == Int)
     ((APSInt*)(char*)Data)->~APSInt();
   else if (Kind == Float)





More information about the cfe-commits mailing list