Changeset 5426


Ignore:
Timestamp:
Apr 25, 2017, 3:52:07 PM (22 months ago)
Author:
nmedfort
Message:

Bug fix for 32-bit

File:
1 edited

Legend:

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

    r5425 r5426  
    2727
    2828void MMapSourceKernel::generateInitializeMethod() {
    29     BasicBlock * emptyFile = CreateBasicBlock("EmptyFile");
    30     BasicBlock * nonEmptyFile = CreateBasicBlock("NonEmptyFile");
    31     BasicBlock * exit = CreateBasicBlock("Exit");
    32 
     29    BasicBlock * const emptyFile = CreateBasicBlock("EmptyFile");
     30    BasicBlock * const nonEmptyFile = CreateBasicBlock("NonEmptyFile");
     31    BasicBlock * const exit = CreateBasicBlock("Exit");
     32    IntegerType * const sizeTy = iBuilder->getSizeTy();
    3333    Value * const fd = getScalarField("fileDescriptor");
    3434    Value * fileSize = iBuilder->CreateCall(mFileSizeFunction, fd);
     35    fileSize = iBuilder->CreateZExtOrTrunc(fileSize, sizeTy);
    3536    if (mCodeUnitWidth > 8) {
    3637        fileSize = iBuilder->CreateUDiv(fileSize, iBuilder->getSize(mCodeUnitWidth / 8));
     
    4041    // we cannot mmap a 0 length file; just create a 1-page sized fake file buffer for simplicity
    4142    iBuilder->SetInsertPoint(emptyFile);
    42     Constant * pageSize = ConstantInt::get(fileSize->getType(), getpagesize());
     43    Constant * pageSize = ConstantInt::get(sizeTy, getpagesize());
    4344    Value * fakeFileBuffer = iBuilder->CreateAnonymousMMap(pageSize);
    4445    iBuilder->CreateBr(exit);
     
    5253    buffer->addIncoming(fakeFileBuffer, emptyFile);
    5354    buffer->addIncoming(fileBackedBuffer, nonEmptyFile);
    54     PHINode * size = iBuilder->CreatePHI(fileSize->getType(), 2);
     55    PHINode * size = iBuilder->CreatePHI(sizeTy, 2);
    5556    size->addIncoming(pageSize, emptyFile);
    5657    size->addIncoming(fileSize, nonEmptyFile);
Note: See TracChangeset for help on using the changeset viewer.