diff options
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 69520fd..afef893 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1381,22 +1381,24 @@ static void DecodeIITType(unsigned &NextElt, ArrayRef<unsigned char> Infos, void Intrinsic::getIntrinsicInfoTableEntries(ID id, SmallVectorImpl<IITDescriptor> &T){ + static_assert(sizeof(IIT_Table[0]) == 2, + "Expect 16-bit entries in IIT_Table"); // Check to see if the intrinsic's type was expressible by the table. - unsigned TableVal = IIT_Table[id-1]; + uint16_t TableVal = IIT_Table[id - 1]; // Decode the TableVal into an array of IITValues. - SmallVector<unsigned char, 8> IITValues; + SmallVector<unsigned char> IITValues; ArrayRef<unsigned char> IITEntries; unsigned NextElt = 0; - if ((TableVal >> 31) != 0) { + if (TableVal >> 15) { // This is an offset into the IIT_LongEncodingTable. IITEntries = IIT_LongEncodingTable; // Strip sentinel bit. - NextElt = (TableVal << 1) >> 1; + NextElt = TableVal & 0x7fff; } else { - // Decode the TableVal into an array of IITValues. If the entry was encoded - // into a single word in the table itself, decode it now. + // 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); TableVal >>= 4; |