[llvm] 9bfeaaf - [LLVM][Intrinsics] Minor cleanup in getIntrinsicInfoTableEntries (#179317)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 3 10:46:49 PST 2026


Author: Rahul Joshi
Date: 2026-02-03T10:46:44-08:00
New Revision: 9bfeaaf28c47d6933cf2fdac6c75323cb1240b5c

URL: https://github.com/llvm/llvm-project/commit/9bfeaaf28c47d6933cf2fdac6c75323cb1240b5c
DIFF: https://github.com/llvm/llvm-project/commit/9bfeaaf28c47d6933cf2fdac6c75323cb1240b5c.diff

LOG: [LLVM][Intrinsics] Minor cleanup in getIntrinsicInfoTableEntries (#179317)

Change `IITValues` from SmallVector to a simple array, since its maximum
size is bounded and relatively small. As a result, using a SmallVector
for this array is not necessary.

Added: 
    

Modified: 
    llvm/lib/IR/Intrinsics.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Intrinsics.cpp b/llvm/lib/IR/Intrinsics.cpp
index b7e9cdf466f75..a2189e70abbb7 100644
--- a/llvm/lib/IR/Intrinsics.cpp
+++ b/llvm/lib/IR/Intrinsics.cpp
@@ -448,8 +448,11 @@ void Intrinsic::getIntrinsicInfoTableEntries(
 
   FixedEncodingTy TableVal = IIT_Table[id - 1];
 
-  // Decode the TableVal into an array of IITValues.
-  SmallVector<unsigned char> IITValues;
+  // Array to hold the inlined fixed encoding values expanded from nibbles to
+  // bytes. Its size can be be atmost FixedEncodingBits / 4 i.e., number
+  // of nibbles that can fit in `FixedEncodingTy`.
+  unsigned char IITValues[FixedEncodingBits / 4];
+
   ArrayRef<unsigned char> IITEntries;
   unsigned NextElt = 0;
   // Check to see if the intrinsic's type was inlined in the fixed encoding
@@ -464,11 +467,11 @@ void Intrinsic::getIntrinsicInfoTableEntries(
     // If the entry was encoded into a single word in the table itself, decode
     // it from an array of nibbles to an array of bytes.
     do {
-      IITValues.push_back(TableVal & 0xF);
+      IITValues[NextElt++] = TableVal & 0xF;
       TableVal >>= 4;
     } while (TableVal);
 
-    IITEntries = IITValues;
+    IITEntries = ArrayRef(IITValues).take_front(NextElt);
     NextElt = 0;
   }
 


        


More information about the llvm-commits mailing list