Ignore:
Timestamp:
Dec 6, 2017, 8:52:32 PM (22 months ago)
Author:
cameron
Message:

Bug fix for scan match processing

File:
1 edited

Legend:

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

    r5757 r5758  
    135135            matchRecordStart->addIncoming(priorRecordStart, prior_breaks_block);
    136136            phiRecordStart->addIncoming(matchRecordStart, loop_final_block);
    137             Value * const matchRecordEnd = iBuilder->CreateAdd(phiScanwordPos, iBuilder->CreateCountForwardZeroes(phiMatchWord, true));
     137            Value * matchRecordEnd = iBuilder->CreateAdd(phiScanwordPos, iBuilder->CreateCountForwardZeroes(phiMatchWord, true));
     138            // It is possible that the matchRecordEnd position is one past EOF.  Make sure not
     139            // to access past EOF.
     140            Value * bufLimit = iBuilder->CreateSub(iBuilder->getBufferedSize("InputStream"), ConstantInt::get(sizeTy, 1));
     141            matchRecordEnd = iBuilder->CreateSelect(iBuilder->CreateICmpULT(matchRecordEnd, bufLimit), matchRecordEnd, bufLimit);
    138142            Function * const dispatcher = m->getFunction("accumulate_match_wrapper"); assert (dispatcher);
    139143            Value * const startPtr = iBuilder->getRawInputPointer("InputStream", matchRecordStart);
Note: See TracChangeset for help on using the changeset viewer.