Lazy loading of builtins for precompiled headers.

PCH files now contain complete information about builtins, including
any declarations that have been synthesized as part of building the
PCH file. When using a PCH file, we do not initialize builtins at all;
when needed, they'll be found in the PCH file.

This optimization translations into a 9% speedup for "Hello, World!"
with Carbon.h as a prefix header and roughly a 5% speedup for 403.gcc
with its prefix header. We're also reading less of the PCH file for
"Hello, World!":

*** PCH Statistics:
  286/20693 types read (1.382110%)
  1630/59230 declarations read (2.751984%)
  764/44914 identifiers read (1.701029%)
  1/32954 statements read (0.003035%)
  5/6187 macros read (0.080815%)

down from

*** PCH Statistics:
  411/20693 types read (1.986179%)
  2553/59230 declarations read (4.310316%)
  1093/44646 identifiers read (2.448148%)
  1/32954 statements read (0.003035%)
  21/6187 macros read (0.339421%)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69815 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 4f2ab2b..3723313 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -1760,7 +1760,9 @@
                                       PP.getTargetInfo(),
                                       PP.getIdentifierTable(),
                                       PP.getSelectorTable(),
-                                      /* FreeMemory = */ !DisableFree));
+                                      /* FreeMemory = */ !DisableFree,
+                                      /* size_reserve = */0,
+                       /* InitializeBuiltins = */ImplicitIncludePCH.empty()));
     
     if (!ImplicitIncludePCH.empty()) {
       // The user has asked us to include a precompiled header. Load
@@ -1788,6 +1790,11 @@
       case PCHReader::IgnorePCH:
         // No suitable PCH file could be found. Just ignore the
         // -include-pch option entirely.
+        
+        // We delayed the initialization of builtins in the hope of
+        // loading the PCH file. Since the PCH file could not be
+        // loaded, initialize builtins now.
+        ContextOwner->InitializeBuiltins(PP.getIdentifierTable());
         break;
       }