[compiler-rt] [compiler-rt][nfc] Return size 0 explicitly when both pointers are NULL (PR #81789)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 13:12:26 PST 2024


================
@@ -93,11 +93,15 @@ uint64_t __llvm_profile_get_counters_size(const char *Begin, const char *End) {
 COMPILER_RT_VISIBILITY
 uint64_t __llvm_profile_get_num_bitmap_bytes(const char *Begin,
                                              const char *End) {
+  if (Begin == NULL && End == NULL)
----------------
teresajohnson wrote:

How about just make this
```
if (Begin == End)
   return 0;
```
Only one comparison and handles more cases without a subtract, if we have to do comparisons anyway.

https://github.com/llvm/llvm-project/pull/81789


More information about the llvm-commits mailing list