Ignore:
Timestamp:
Sep 22, 2017, 3:36:36 PM (21 months ago)
Author:
nmedfort
Message:

Minor bug fixes and removal of inadvertent check in for StreamSet?.cpp/h

File:
1 edited

Legend:

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

    r5646 r5647  
    556556            iBuilder->CreateAlignedStore(value, ptr, alignment);
    557557        } else if (const Lookahead * l = dyn_cast<Lookahead>(stmt)) {
    558             Var * var = nullptr;
    559558            PabloAST * stream = l->getExpression();
    560             Value * index = iBuilder->getInt32(0);
     559            Value * index = nullptr;
    561560            if (LLVM_UNLIKELY(isa<Extract>(stream))) {
    562                 var = cast<Var>(cast<Extract>(stream)->getArray());
     561                stream = cast<Extract>(stream)->getArray();
     562                index = compileExpression(iBuilder, cast<Extract>(stream)->getIndex());
     563            } else {
     564                index = iBuilder->getInt32(0);
    563565            }
    564566            const auto bit_shift = (l->getAmount() % iBuilder->getBitBlockWidth());
    565567            const auto block_shift = (l->getAmount() / iBuilder->getBitBlockWidth());
    566 
    567             Value * ptr = iBuilder->getAdjustedInputStreamBlockPtr(iBuilder->getSize(block_shift), var->getName(), index);
     568            Value * ptr = iBuilder->getAdjustedInputStreamBlockPtr(iBuilder->getSize(block_shift), cast<Var>(stream)->getName(), index);
    568569            Value * lookAhead = iBuilder->CreateBlockAlignedLoad(ptr);
    569570            if (bit_shift == 0) {  // Simple case with no intra-block shifting.
    570571                value = lookAhead;
    571572            } else { // Need to form shift result from two adjacent blocks.
    572                 Value * ptr = iBuilder->getAdjustedInputStreamBlockPtr(iBuilder->getSize(block_shift + 1), var->getName(), index);
     573                Value * ptr = iBuilder->getAdjustedInputStreamBlockPtr(iBuilder->getSize(block_shift + 1), cast<Var>(stream)->getName(), index);
    573574                Value * lookAhead1 = iBuilder->CreateBlockAlignedLoad(ptr);
    574575                if (LLVM_UNLIKELY((bit_shift % 8) == 0)) { // Use a single whole-byte shift, if possible.
Note: See TracChangeset for help on using the changeset viewer.