[llvm] 77e5c5d - Revert "[LEB128] Mark error condition with LLVM_UNLIKELY"

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 12:40:47 PST 2023


Author: Adrian Prantl
Date: 2023-11-29T12:40:36-08:00
New Revision: 77e5c5dbd88a7845fe5b8225f6bb139048ced1a9

URL: https://github.com/llvm/llvm-project/commit/77e5c5dbd88a7845fe5b8225f6bb139048ced1a9
DIFF: https://github.com/llvm/llvm-project/commit/77e5c5dbd88a7845fe5b8225f6bb139048ced1a9.diff

LOG: Revert "[LEB128] Mark error condition with LLVM_UNLIKELY"

This reverts commit 80fc872a24c4dca4820d2e7885b5ee9195bec42a.

Added: 
    

Modified: 
    llvm/include/llvm/Support/LEB128.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/LEB128.h b/llvm/include/llvm/Support/LEB128.h
index 7fc572b6ff06efc..40b6cf79bacf758 100644
--- a/llvm/include/llvm/Support/LEB128.h
+++ b/llvm/include/llvm/Support/LEB128.h
@@ -135,16 +135,15 @@ inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n = nullptr,
   uint64_t Value = 0;
   unsigned Shift = 0;
   do {
-    if (LLVM_UNLIKELY(p == end)) {
+    if (p == end) {
       if (error)
         *error = "malformed uleb128, extends past end";
       Value = 0;
       break;
     }
     uint64_t Slice = *p & 0x7f;
-    if (LLVM_UNLIKELY(Shift >= 63) &&
-        ((Shift == 63 && (Slice << Shift >> Shift) != Slice) ||
-         (Shift > 63 && Slice != 0))) {
+    if (Shift >= 63 && ((Shift == 63 && (Slice << Shift >> Shift) != Slice) ||
+                        (Shift > 63 && Slice != 0))) {
       if (error)
         *error = "uleb128 too big for uint64";
       Value = 0;
@@ -170,7 +169,7 @@ inline int64_t decodeSLEB128(const uint8_t *p, unsigned *n = nullptr,
   unsigned Shift = 0;
   uint8_t Byte;
   do {
-    if (LLVM_UNLIKELY(p == end)) {
+    if (p == end) {
       if (error)
         *error = "malformed sleb128, extends past end";
       if (n)
@@ -179,9 +178,8 @@ inline int64_t decodeSLEB128(const uint8_t *p, unsigned *n = nullptr,
     }
     Byte = *p;
     uint64_t Slice = Byte & 0x7f;
-    if (LLVM_UNLIKELY(Shift >= 63) &&
-        ((Shift == 63 && Slice != 0 && Slice != 0x7f) ||
-         (Shift > 63 && Slice != (Value < 0 ? 0x7f : 0x00)))) {
+    if ((Shift >= 63) && ((Shift == 63 && Slice != 0 && Slice != 0x7f) ||
+                          (Shift > 63 && Slice != (Value < 0 ? 0x7f : 0x00)))) {
       if (error)
         *error = "sleb128 too big for int64";
       if (n)


        


More information about the llvm-commits mailing list