Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions llvm/lib/Object/SYCLBIN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class SYCLBINByteTableBlockReader : public SYCLBINBlockReader {
Expected<StringRef> GetBinaryBlob(size_t ByteOffset, uint64_t BlobSize) {
if (Error ReadSizeError = ReadSizeCheck(ByteOffset, BlobSize))
return ReadSizeError;
return llvm::StringRef{Data + ByteOffset, BlobSize};
return llvm::StringRef{Data + ByteOffset, static_cast<size_t>(BlobSize)};
}

Expected<std::unique_ptr<llvm::util::PropertySetRegistry>>
Expand Down Expand Up @@ -334,15 +334,15 @@ Expected<std::unique_ptr<SYCLBIN>> SYCLBIN::read(MemoryBufferRef Source) {
std::to_string(FileHeader->Version) + ".");
Result->Version = FileHeader->Version;

const uint64_t AMHeaderBlockSize =
const size_t AMHeaderBlockSize =
sizeof(AbstractModuleHeaderType) * FileHeader->AbstractModuleCount;
const uint64_t IRMHeaderBlockSize =
const size_t IRMHeaderBlockSize =
sizeof(IRModuleHeaderType) * FileHeader->IRModuleCount;
const uint64_t NDCIHeaderBlockSize = sizeof(NativeDeviceCodeImageHeaderType) *
FileHeader->NativeDeviceCodeImageCount;
const uint64_t HeaderBlockSize = sizeof(FileHeaderType) + AMHeaderBlockSize +
IRMHeaderBlockSize + NDCIHeaderBlockSize;
const uint64_t AlignedMetadataByteTableSize =
const size_t NDCIHeaderBlockSize = sizeof(NativeDeviceCodeImageHeaderType) *
FileHeader->NativeDeviceCodeImageCount;
const size_t HeaderBlockSize = sizeof(FileHeaderType) + AMHeaderBlockSize +
IRMHeaderBlockSize + NDCIHeaderBlockSize;
const size_t AlignedMetadataByteTableSize =
alignTo(FileHeader->MetadataByteTableSize, 8);
if (Source.getBufferSize() < HeaderBlockSize + AlignedMetadataByteTableSize +
FileHeader->BinaryByteTableSize)
Expand All @@ -354,10 +354,10 @@ Expected<std::unique_ptr<SYCLBIN>> SYCLBIN::read(MemoryBufferRef Source) {
HeaderBlockSize};
SYCLBINByteTableBlockReader MetadataByteTableBlockReader{
Source.getBufferStart() + HeaderBlockSize,
FileHeader->MetadataByteTableSize};
static_cast<size_t>(FileHeader->MetadataByteTableSize)};
SYCLBINByteTableBlockReader BinaryByteTableBlockReader{
Source.getBufferStart() + HeaderBlockSize + AlignedMetadataByteTableSize,
FileHeader->BinaryByteTableSize};
static_cast<size_t>(FileHeader->BinaryByteTableSize)};

// Read global metadata.
if (Error E = MetadataByteTableBlockReader
Expand All @@ -373,7 +373,7 @@ Expected<std::unique_ptr<SYCLBIN>> SYCLBIN::read(MemoryBufferRef Source) {

// Read the header for the current abstract module.
const AbstractModuleHeaderType *AMHeader = nullptr;
const uint64_t AMHeaderByteOffset =
const size_t AMHeaderByteOffset =
sizeof(FileHeaderType) + sizeof(AbstractModuleHeaderType) * I;
if (Error E =
HeaderBlockReader
Expand All @@ -395,7 +395,7 @@ Expected<std::unique_ptr<SYCLBIN>> SYCLBIN::read(MemoryBufferRef Source) {

// Read the header for the current IR module.
const IRModuleHeaderType *IRMHeader = nullptr;
const uint64_t IRMHeaderByteOffset =
const size_t IRMHeaderByteOffset =
sizeof(FileHeaderType) + AMHeaderBlockSize +
sizeof(IRModuleHeaderType) * (AMHeader->IRModuleOffset + J);
if (Error E = HeaderBlockReader
Expand Down Expand Up @@ -425,7 +425,7 @@ Expected<std::unique_ptr<SYCLBIN>> SYCLBIN::read(MemoryBufferRef Source) {

// Read the header for the current native device code image.
const NativeDeviceCodeImageHeaderType *NDCIHeader = nullptr;
const uint64_t NDCIHeaderByteOffset =
const size_t NDCIHeaderByteOffset =
sizeof(FileHeaderType) + AMHeaderBlockSize + IRMHeaderBlockSize +
sizeof(NativeDeviceCodeImageHeaderType) *
(AMHeader->NativeDeviceCodeImageOffset + J);
Expand Down
Loading