Recover performance loss after PagedVector introduction (#67972)
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index d3ccc7e..e0f1ea4 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -724,7 +724,7 @@
///
/// Negative FileIDs are indexes into this table. To get from ID to an index,
/// use (-ID - 2).
- llvm::PagedVector<SrcMgr::SLocEntry> LoadedSLocEntryTable;
+ llvm::PagedVector<SrcMgr::SLocEntry, 32> LoadedSLocEntryTable;
/// For each allocation in LoadedSLocEntryTable, we keep the first FileID.
/// We assume exactly one allocation per AST file, and use that to determine
diff --git a/llvm/include/llvm/ADT/PagedVector.h b/llvm/include/llvm/ADT/PagedVector.h
index 3fcca6d..52ecd0b 100644
--- a/llvm/include/llvm/ADT/PagedVector.h
+++ b/llvm/include/llvm/ADT/PagedVector.h
@@ -84,7 +84,7 @@
assert(Index / PageSize < PageToDataPtrs.size());
T *&PagePtr = PageToDataPtrs[Index / PageSize];
// If the page was not yet allocated, allocate it.
- if (!PagePtr) {
+ if (LLVM_UNLIKELY(!PagePtr)) {
PagePtr = Allocator.getPointer()->template Allocate<T>(PageSize);
// We need to invoke the default constructor on all the elements of the
// page.