Changeset 5170 for icGREP


Ignore:
Timestamp:
Sep 28, 2016, 9:31:53 AM (3 years ago)
Author:
cameron
Message:

Fix for Pablo bounded while statements

File:
1 edited

Legend:

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

    r5169 r5170  
    242242#ifdef ENABLE_BOUNDED_WHILE
    243243    if (whileStatement->getBound()) {
    244         PHINode * bound_phi = iBuilder->CreatePHI(iBuilder->getSizeTy());
    245         bound_phi->addIncoming(ConstantInt::get(iBuilder->getSizeTy(), whileStatement->getBound()));
     244        bound_phi = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2, "while_bound");
     245        bound_phi->addIncoming(ConstantInt::get(iBuilder->getSizeTy(), whileStatement->getBound()), whileEntryBlock);
    246246    }
    247247#endif
    248 
    249248    //
    250249    // Now compile the loop body proper.  Carry-out accumulated values
     
    266265    if (whileStatement->getBound()) {
    267266        Value * new_bound = iBuilder->CreateSub(bound_phi, ConstantInt::get(iBuilder->getSizeTy(), 1));
    268         bound_phi->addIncoming(new_bound, whileExitBlock)));
    269         cond_expr = iBuilder->CreateAnd(cond_expr, iBuilder->CreateCmpGE(new_bound, ConstantInt::GetNullValue(iBuilder->getSizeTy()));
     267        bound_phi->addIncoming(new_bound, whileExitBlock);
     268        cond_expr = iBuilder->CreateAnd(cond_expr, iBuilder->CreateICmpUGT(new_bound, ConstantInt::getNullValue(iBuilder->getSizeTy())));
    270269    }
    271270#endif   
Note: See TracChangeset for help on using the changeset viewer.