Ignore:
Timestamp:
Feb 21, 2017, 2:22:21 PM (3 years ago)
Author:
nmedfort
Message:

Work on parenthesis matching and expandable buffers. Changed CBuilder CreateMemZero? to zero n bytes rather than n units to conform to the built-in CreateMemSet? and CreateMemCpy? methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r5329 r5337  
    164164
    165165        Type * const carryStateType = array->getType()->getPointerElementType();
     166
     167        Constant * carryStateWidth = ConstantExpr::getIntegerCast(ConstantExpr::getSizeOf(carryStateType), capacity->getType(), false);
     168
    166169        Value * newCapacity = iBuilder->CreateMul(iBuilder->CreateAdd(index, iBuilder->getSize(1)), iBuilder->getSize(2));
    167170        Value * newArray = iBuilder->CreateAlignedMalloc(carryStateType, newCapacity, iBuilder->getCacheAlignment());
     
    175178        iBuilder->SetInsertPoint(cleanUpBlock);
    176179
    177         iBuilder->CreateMemCpy(newArray, array, capacity, iBuilder->getCacheAlignment());
     180        iBuilder->CreateMemCpy(newArray, array, iBuilder->CreateMul(capacity, carryStateWidth), iBuilder->getCacheAlignment());
    178181        iBuilder->CreateAlignedFree(array);
    179182        iBuilder->CreateBr(zeroBlock);
     
    181184        iBuilder->SetInsertPoint(zeroBlock);
    182185
    183         iBuilder->CreateMemZero(iBuilder->CreateGEP(newArray, capacity), iBuilder->CreateSub(newCapacity, capacity), iBuilder->getCacheAlignment());
     186        iBuilder->CreateMemZero(iBuilder->CreateGEP(newArray, capacity), iBuilder->CreateMul(iBuilder->CreateSub(newCapacity, capacity), carryStateWidth), iBuilder->getCacheAlignment());
    184187        iBuilder->CreateStore(newCapacity, capacityPtr);
    185188        iBuilder->CreateStore(newArray, arrayPtr);
Note: See TracChangeset for help on using the changeset viewer.