[cfe-commits] r152322 - /cfe/trunk/include/clang/Basic/PartialDiagnostic.h

Daniel Dunbar daniel at zuster.org
Thu Mar 8 10:43:59 PST 2012


Author: ddunbar
Date: Thu Mar  8 12:43:59 2012
New Revision: 152322

URL: http://llvm.org/viewvc/llvm-project?rev=152322&view=rev
Log:
[Basic] PartialDiagnostic: Manual split out the cold part of freeStorage(), the
hot path will typically profitably get inlined (based on what I see from the
users of PartialDiagnostic).

Modified:
    cfe/trunk/include/clang/Basic/PartialDiagnostic.h

Modified: cfe/trunk/include/clang/Basic/PartialDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/PartialDiagnostic.h?rev=152322&r1=152321&r2=152322&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/PartialDiagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/PartialDiagnostic.h Thu Mar  8 12:43:59 2012
@@ -141,6 +141,16 @@
     if (!DiagStorage)
       return;
 
+    // The hot path for PartialDiagnostic is when we just used it to wrap an ID
+    // (typically so we have the flexibility of passing a more complex
+    // diagnostic into the callee, but that does not commonly occur).
+    //
+    // Split this out into a slow function for silly compilers (*cough*) which
+    // can't do decent partial inlining.
+    freeStorageSlow();
+  }
+
+  void freeStorageSlow() {
     if (Allocator)
       Allocator->Deallocate(DiagStorage);
     else if (Allocator != reinterpret_cast<StorageAllocator *>(~uintptr_t(0)))





More information about the cfe-commits mailing list