Ignore:
Timestamp:
Sep 10, 2017, 11:24:44 PM (20 months ago)
Author:
nmedfort
Message:

Bug fix to avoid a LLVM bug when using a cross-compilable void pointer type on 32-bit VMs running on a 64-bit host.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/source_kernel.cpp

    r5513 r5633  
    6464    size->addIncoming(pageSize, emptyFile);
    6565    size->addIncoming(fileSize, nonEmptyFile);
    66     kb->setBaseAddress("sourceBuffer", buffer);
     66    Value * bufferPtr = kb->CreatePointerCast(buffer, kb->getInt8PtrTy());
     67    kb->setBaseAddress("sourceBuffer", bufferPtr);
    6768    kb->setBufferedSize("sourceBuffer", size);
    68     kb->setScalarField("readableBuffer", buffer);
     69    kb->setScalarField("readableBuffer", bufferPtr);
    6970    kb->setScalarField("fileSize", fileSize);
    7071    kb->setCapacity("sourceBuffer", fileSize);
     
    8384    Value * consumed = kb->getConsumedItemCount("sourceBuffer");
    8485    IntegerType * const consumedTy = cast<IntegerType>(consumed->getType());
    85     Type * const voidPtrTy = kb->getVoidPtrTy();
     86    Type * const int8PtrTy = kb->getInt8PtrTy();
    8687
    8788    DataLayout DL(kb->getModule());
     
    116117
    117118    kb->SetInsertPoint(dropPages);
    118     kb->CreateMAdvise(kb->CreateIntToPtr(readableBuffer, voidPtrTy), unnecessaryBytes, CBuilder::ADVICE_DONTNEED);
    119     readableBuffer = kb->CreateIntToPtr(kb->CreateAdd(readableBuffer, unnecessaryBytes), voidPtrTy);
     119    kb->CreateMAdvise(kb->CreateIntToPtr(readableBuffer, int8PtrTy), unnecessaryBytes, CBuilder::ADVICE_DONTNEED);
     120    readableBuffer = kb->CreateIntToPtr(kb->CreateAdd(readableBuffer, unnecessaryBytes), int8PtrTy);
    120121    kb->setScalarField("readableBuffer", readableBuffer);
    121122    kb->CreateBr(processSegment);
     
    150151{Binding{kb->getStreamSetTy(1, codeUnitWidth), "sourceBuffer"}},
    151152{Binding{kb->getInt32Ty(), "fileDescriptor"}},
    152 {Binding{kb->getSizeTy(), "fileSize"}}, {Binding{kb->getVoidPtrTy(), "readableBuffer"}})
     153{Binding{kb->getSizeTy(), "fileSize"}}, {Binding{kb->getInt8PtrTy(), "readableBuffer"}})
    153154, mSegmentBlocks(blocksPerSegment)
    154155, mCodeUnitWidth(codeUnitWidth)
     
    344345
    345346void MemorySourceKernel::generateInitializeMethod(const std::unique_ptr<KernelBuilder> & kb) {
    346     kb->setBaseAddress("sourceBuffer", kb->CreatePointerCast(kb->getScalarField("fileSource"), kb->getVoidPtrTy()));
     347    kb->setBaseAddress("sourceBuffer", kb->CreatePointerCast(kb->getScalarField("fileSource"), kb->getInt8Ty()));
    347348    kb->setBufferedSize("sourceBuffer", kb->getScalarField("fileSize"));
    348349    kb->setCapacity("sourceBuffer", kb->getScalarField("fileSize"));
Note: See TracChangeset for help on using the changeset viewer.