Changeset 5058 for icGREP


Ignore:
Timestamp:
Jun 15, 2016, 2:55:16 PM (3 years ago)
Author:
nmedfort
Message:

Potential bug fix for short advances

File:
1 edited

Legend:

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

    r5045 r5058  
    2727    mCarryPackType = mBitBlockType;
    2828    const unsigned totalCarryDataSize = enumerate(mRootScope, 0, 0);
    29 
    3029
    3130    mCarryPackPtr.resize(totalCarryDataSize + 1, nullptr);
     
    157156    Value * result = nullptr;
    158157    Value * const carryIn = getCarryPack(index);
     158    assert (index < mCarryOutPack.size());
    159159    mCarryOutPack[index] = value;
    160160    if (mCarryInfo->getWhileDepth() == 0) {
     
    498498    if (mCarryInPack[packIndex] == nullptr) {
    499499        Value * const packPtr = iBuilder->CreateGEP(mCarryPackBasePtr, iBuilder->getInt64(packIndex));
     500        assert (packIndex < mCarryPackPtr.size());
    500501        mCarryPackPtr[packIndex] = packPtr;
    501502        mCarryInPack[packIndex] = iBuilder->CreateBlockAlignedLoad(packPtr);
     
    508509 ** ------------------------------------------------------------------------------------------------------------- */
    509510void CarryManager::storeCarryOut(const unsigned packIndex) {
    510     assert (packIndex < mCarryInPack.size());
     511    assert (packIndex < mCarryOutPack.size());
    511512    assert (mCarryOutPack[packIndex]);
    512     assert (mCarryPackPtr[packIndex]);
    513     iBuilder->CreateBlockAlignedStore(mCarryOutPack[packIndex], mCarryPackPtr[packIndex]);
     513    assert (packIndex < mCarryPackPtr.size());
     514    Value * const ptr = mCarryPackPtr[packIndex];
     515    assert (ptr);
     516    assert (cast<PointerType>(ptr->getType())->getElementType() == mBitBlockType);
     517    Value * const value = iBuilder->CreateBitCast(mCarryOutPack[packIndex], mBitBlockType);
     518    iBuilder->CreateBlockAlignedStore(value, ptr);
    514519}
    515520
     
    521526
    522527inline unsigned CarryManager::addPosition(const unsigned localIndex) const {
     528    assert (mCarryInfo);
    523529    return relativeFrameOffset(mCarryInfo->addWithCarry.frameOffset, localIndex);
    524530}
    525531
    526532inline unsigned CarryManager::unitAdvancePosition(const unsigned localIndex) const {
     533    assert (mCarryInfo);
    527534    return relativeFrameOffset(mCarryInfo->unitAdvance.frameOffset, localIndex);
    528535}
    529536
    530537inline unsigned CarryManager::shortAdvancePosition(const unsigned localIndex) const {
     538    assert (mCarryInfo);
    531539    return relativeFrameOffset(mCarryInfo->shortAdvance.frameOffset, localIndex);
    532540}
    533541
    534542inline unsigned CarryManager::longAdvancePosition(const unsigned localIndex) const {
     543    assert (mCarryInfo);
    535544    return (mCurrentFrameIndex + mCarryInfo->longAdvance.frameOffset) + localIndex;
    536545}
    537546
    538547inline unsigned CarryManager::localBasePack() const {
     548    assert (mCarryInfo);
    539549    return (mCurrentFrameIndex + mCarryInfo->shortAdvance.frameOffset);
    540550}
     
    545555
    546556inline unsigned CarryManager::summaryPack() const {
     557    assert (mCarryInfo);
    547558    return relativeFrameOffset(mCarryInfo->summary.frameOffset, 0);
    548559}
    549560
    550561inline bool CarryManager::hasSummary() const {
     562    assert (mCarryInfo);
    551563    return mCarryInfo->explicitSummaryRequired() && !(mCarryInfo->hasLongAdvances());
    552564}
Note: See TracChangeset for help on using the changeset viewer.