[llvm] Hint for branch likelihood (PR #67972)
Giulio Eulisse via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 2 04:08:44 PDT 2023
https://github.com/ktf created https://github.com/llvm/llvm-project/pull/67972
None
>From 154f82bd0e35e9d8ad8f8812ba3eb1cf8d211003 Mon Sep 17 00:00:00 2001
From: Giulio Eulisse <10544+ktf at users.noreply.github.com>
Date: Mon, 2 Oct 2023 13:01:14 +0200
Subject: [PATCH] Hint for branch likelihood
---
llvm/include/llvm/ADT/PagedVector.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/ADT/PagedVector.h b/llvm/include/llvm/ADT/PagedVector.h
index 667bece6d718385..f8d014c9c84dab6 100644
--- a/llvm/include/llvm/ADT/PagedVector.h
+++ b/llvm/include/llvm/ADT/PagedVector.h
@@ -84,7 +84,7 @@ template <typename T, size_t PageSize = 1024 / sizeof(T)> class PagedVector {
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.
More information about the llvm-commits
mailing list