Ignore:
Timestamp:
May 16, 2017, 4:13:53 PM (2 years ago)
Author:
nmedfort
Message:

Bug fix check in for DumpTrace?, compilation of DoBlock? / DoFinalBlock? functions. Pablo CodeMotionPass? optimized and enabled by default.

Location:
icGREP/icgrep-devel/icgrep/IR_Gen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.cpp

    r5440 r5454  
    427427    len = CreateZExtOrTrunc(len, sizeTy);
    428428    if (codegen::EnableAsserts) {
     429        DataLayout DL(getModule());
     430        IntegerType * const intPtrTy = getIntPtrTy(DL);
    429431        CreateAssert(len, "CreateMUnmap: length cannot be 0");
    430         Value * const addrValue = CreatePtrToInt(addr, sizeTy);
    431         Value * const pageOffset = CreateURem(addrValue, getSize(getpagesize()));
    432         CreateAssert(CreateICmpEQ(pageOffset, getSize(0)), "CreateMUnmap: addr must be a multiple of the page size");
    433         Value * const boundCheck = CreateICmpULT(addrValue, CreateSub(ConstantInt::getAllOnesValue(sizeTy), len));
     432        Value * const addrValue = CreatePtrToInt(addr, intPtrTy);
     433        Value * const pageOffset = CreateURem(addrValue, ConstantInt::get(intPtrTy, getpagesize()));
     434        CreateAssert(CreateICmpEQ(pageOffset, ConstantInt::getNullValue(intPtrTy)), "CreateMUnmap: addr must be a multiple of the page size");
     435        Value * const boundCheck = CreateICmpULT(addrValue, CreateSub(ConstantInt::getAllOnesValue(intPtrTy), CreateZExtOrTrunc(len, intPtrTy)));
    434436        CreateAssert(boundCheck, "CreateMUnmap: addresses in [addr, addr+len) are outside the valid address space range");
    435437    }
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_builder.cpp

    r5440 r5454  
    349349    const auto alignment = mBitBlockWidth / 8;
    350350    if (codegen::EnableAsserts) {
    351         Value * alignmentOffset = CreateURem(CreatePtrToInt(ptr, getSizeTy()), getSize(alignment));
    352         Value * alignmentCheck = CreateICmpEQ(alignmentOffset, getSize(0));
     351        DataLayout DL(getModule());
     352        IntegerType * const intPtrTy = getIntPtrTy(DL);
     353        Value * alignmentOffset = CreateURem(CreatePtrToInt(ptr, intPtrTy), ConstantInt::get(intPtrTy, alignment));
     354        Value * alignmentCheck = CreateICmpEQ(alignmentOffset, ConstantInt::getNullValue(intPtrTy));
    353355        CreateAssert(alignmentCheck, "CreateBlockAlignedLoad: pointer is unaligned");
    354356    }
     
    359361    const auto alignment = mBitBlockWidth / 8;
    360362    if (codegen::EnableAsserts) {
    361         Value * alignmentOffset = CreateURem(CreatePtrToInt(ptr, getSizeTy()), getSize(alignment));
    362         Value * alignmentCheck = CreateICmpEQ(alignmentOffset, getSize(0));
     363        DataLayout DL(getModule());
     364        IntegerType * const intPtrTy = getIntPtrTy(DL);
     365        Value * alignmentOffset = CreateURem(CreatePtrToInt(ptr, intPtrTy), ConstantInt::get(intPtrTy, alignment));
     366        Value * alignmentCheck = CreateICmpEQ(alignmentOffset, ConstantInt::getNullValue(intPtrTy));
    363367        CreateAssert(alignmentCheck, "CreateBlockAlignedStore: pointer is not aligned");
    364368    }
Note: See TracChangeset for help on using the changeset viewer.