Ignore:
Timestamp:
Dec 28, 2016, 7:21:28 PM (2 years ago)
Author:
nmedfort
Message:

Cleaned up memory leaks + some warning messages.

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5238 r5240  
    5454    virtual llvm::Value * getProducedItemCount(llvm::Value * kernelInstance) override;
    5555    virtual void initializeKernelState(Value * self);
    56     llvm::Value * getTerminationSignal(llvm::Value * kernelInstance);
     56    llvm::Value * getTerminationSignal(llvm::Value * kernelInstance) override;
    5757   
    5858    inline llvm::IntegerType * getSizeTy() {
  • icGREP/icgrep-devel/icgrep/kernels/radix64.cpp

    r5238 r5240  
    142142    iBuilder->CreateAlignedStore(expand0, loopOutput_ptr, packAlign);
    143143    // Step 2 of the main loop.
    144     Value * inPack1_ptr = iBuilder->CreateGEP(loopInput_ptr, {iBuilder->getInt32(1)});
    145     Value * outPack1_ptr = iBuilder->CreateGEP(loopOutput_ptr, {iBuilder->getInt32(1)});
     144    Value * inPack1_ptr = iBuilder->CreateGEP(loopInput_ptr, iBuilder->getInt32(1));
     145    Value * outPack1_ptr = iBuilder->CreateGEP(loopOutput_ptr, iBuilder->getInt32(1));
    146146    Value * pack1 = iBuilder->fwCast(8, iBuilder->CreateAlignedLoad(inPack1_ptr, packAlign));
    147147    Value * expand1 = iBuilder->bitCast(iBuilder->CreateShuffleVector(pack0, pack1, expand_3_4_shuffle[1]));
    148148    iBuilder->CreateAlignedStore(expand1, outPack1_ptr, packAlign);
    149149    // Step 3 of the main loop.
    150     Value * inPack2_ptr = iBuilder->CreateGEP(loopInput_ptr, {iBuilder->getInt32(2)});
    151     Value * outPack2_ptr = iBuilder->CreateGEP(loopOutput_ptr, {iBuilder->getInt32(2)});
     150    Value * inPack2_ptr = iBuilder->CreateGEP(loopInput_ptr, iBuilder->getInt32(2));
     151    Value * outPack2_ptr = iBuilder->CreateGEP(loopOutput_ptr, iBuilder->getInt32(2));
    152152    Value * pack2 = iBuilder->fwCast(8, iBuilder->CreateAlignedLoad(inPack2_ptr, packAlign));
    153153    Value * expand2 = iBuilder->bitCast(iBuilder->CreateShuffleVector(pack1, pack2, expand_3_4_shuffle[2]));
    154154    iBuilder->CreateAlignedStore(expand2, outPack2_ptr, packAlign);
    155     Value * outPack3_ptr = iBuilder->CreateGEP(loopOutput_ptr, {iBuilder->getInt32(3)});
     155    Value * outPack3_ptr = iBuilder->CreateGEP(loopOutput_ptr, iBuilder->getInt32(3));
    156156    Value * expand3 = iBuilder->bitCast(iBuilder->CreateShuffleVector(pack2, undefPack, expand_3_4_shuffle[3]));
    157157    iBuilder->CreateAlignedStore(expand3, outPack3_ptr, packAlign);
    158158
    159     Value * loopNextInputPack = iBuilder->CreateGEP(loopInput_ptr, {iBuilder->getInt32(3)});
     159    Value * loopNextInputPack = iBuilder->CreateGEP(loopInput_ptr, iBuilder->getInt32(3));
    160160
    161161
     
    167167
    168168    Value * loopNextOutputPack;
    169     loopNextOutputPack = iBuilder->CreateGEP(loopOutput_ptr, {iBuilder->getInt32(4)});
     169    loopNextOutputPack = iBuilder->CreateGEP(loopOutput_ptr, iBuilder->getInt32(4));
    170170
    171171    loopInput_ptr->addIncoming(loopNextInputPack, expand_3_4_loop);
     
    212212    iBuilder->CreateCondBr(condition_c, step2store, step2load);
    213213    iBuilder->SetInsertPoint(step2load);
    214     inPack1_ptr = iBuilder->CreateGEP(loopExitInput_ptr, {iBuilder->getInt32(1)});
     214    inPack1_ptr = iBuilder->CreateGEP(loopExitInput_ptr, iBuilder->getInt32(1));
    215215    pack1 = iBuilder->fwCast(8, iBuilder->CreateAlignedLoad(inPack1_ptr, packAlign));
    216216    iBuilder->CreateBr(step2store);
     
    219219    pack1phi->addIncoming(undefPack, finalStep2);
    220220    pack1phi->addIncoming(pack1, step2load);
    221     outPack1_ptr = iBuilder->CreateGEP(loopExitOutput_ptr, {iBuilder->getInt32(1)});
     221    outPack1_ptr = iBuilder->CreateGEP(loopExitOutput_ptr, iBuilder->getInt32(1));
    222222    expand1 = iBuilder->bitCast(iBuilder->CreateShuffleVector(pack0, pack1phi, expand_3_4_shuffle[1]));
    223223    iBuilder->CreateAlignedStore(expand1, outPack1_ptr, packAlign);
     
    229229    iBuilder->CreateCondBr(condition_e, step3store, step3load);
    230230    iBuilder->SetInsertPoint(step3load);
    231     inPack2_ptr = iBuilder->CreateGEP(loopExitInput_ptr, {iBuilder->getInt32(2)});
     231    inPack2_ptr = iBuilder->CreateGEP(loopExitInput_ptr, iBuilder->getInt32(2));
    232232    pack2 = iBuilder->fwCast(8, iBuilder->CreateAlignedLoad(inPack2_ptr, packAlign));
    233233    iBuilder->CreateBr(step3store);
     
    236236    pack2phi->addIncoming(undefPack, finalStep3);
    237237    pack2phi->addIncoming(pack2, step3load);
    238     outPack2_ptr = iBuilder->CreateGEP(loopExitOutput_ptr, {iBuilder->getInt32(2)});
     238    outPack2_ptr = iBuilder->CreateGEP(loopExitOutput_ptr, iBuilder->getInt32(2));
    239239    expand2 = iBuilder->bitCast(iBuilder->CreateShuffleVector(pack1phi, pack2phi, expand_3_4_shuffle[2]));
    240240    iBuilder->CreateAlignedStore(expand2, outPack2_ptr, packAlign);
     
    242242    iBuilder->CreateCondBr(condition_f, itemsDone, step3store2);
    243243    iBuilder->SetInsertPoint(step3store2);
    244     outPack3_ptr = iBuilder->CreateGEP(loopExitOutput_ptr, {iBuilder->getInt32(3)});
     244    outPack3_ptr = iBuilder->CreateGEP(loopExitOutput_ptr, iBuilder->getInt32(3));
    245245    expand3 = iBuilder->bitCast(iBuilder->CreateShuffleVector(pack2phi, undefPack, expand_3_4_shuffle[3]));
    246246    iBuilder->CreateAlignedStore(expand3, outPack3_ptr, packAlign);
     
    419419    Value * remainOutputStart = iBuilder->CreateSub(remainingBytes, remainMod4);
    420420
    421     Value * firstRemainByte = iBuilder->CreateLoad(iBuilder->CreateGEP(i8input_ptr, {iBuilder->getInt32(0)}));
     421    Value * firstRemainByte = iBuilder->CreateLoad(iBuilder->CreateGEP(i8input_ptr, iBuilder->getInt32(0)));
    422422
    423423    Value * first_move_right_2_mask = ConstantInt::get(iBuilder->getInt8Ty(), 0xFC);
     
    427427    Value * first_move_left_4_byte = iBuilder->CreateShl(iBuilder->CreateAnd(firstRemainByte, first_move_left_4_mask), 4);
    428428
    429     iBuilder->CreateStore(first_output_byte, iBuilder->CreateGEP(i8output_ptr, {iBuilder->CreateAdd(remainOutputStart, iBuilder->getInt64(0))}));
     429    iBuilder->CreateStore(first_output_byte, iBuilder->CreateGEP(i8output_ptr, iBuilder->CreateAdd(remainOutputStart, iBuilder->getInt64(0))));
    430430
    431431
     
    433433    iBuilder->SetInsertPoint(handleRemainSecondByte);
    434434
    435     Value * secondRemainByte = iBuilder->CreateLoad(iBuilder->CreateGEP(i8input_ptr, {iBuilder->getInt32(1)}));
     435    Value * secondRemainByte = iBuilder->CreateLoad(iBuilder->CreateGEP(i8input_ptr, iBuilder->getInt32(1)));
    436436    Value * second_move_right_4_mask = ConstantInt::get(iBuilder->getInt8Ty(), 0xF0);
    437437    Value * second_move_right_4_byte = iBuilder->CreateLShr(iBuilder->CreateAnd(secondRemainByte, second_move_right_4_mask), 4);
    438438    Value * second_output_byte = iBuilder->CreateOr(first_move_left_4_byte, second_move_right_4_byte);
    439     iBuilder->CreateStore(second_output_byte, iBuilder->CreateGEP(i8output_ptr, {iBuilder->CreateAdd(remainOutputStart, iBuilder->getInt64(1))}));
     439    iBuilder->CreateStore(second_output_byte, iBuilder->CreateGEP(i8output_ptr, iBuilder->CreateAdd(remainOutputStart, iBuilder->getInt64(1))));
    440440
    441441    Value * second_move_left_2_mask = ConstantInt::get(iBuilder->getInt8Ty(), 0x0F);
    442442    Value * second_move_left_2_byte = iBuilder->CreateShl(iBuilder->CreateAnd(secondRemainByte, second_move_left_2_mask), 2);
    443     iBuilder->CreateStore(second_move_left_2_byte, iBuilder->CreateGEP(i8output_ptr, {iBuilder->CreateAdd(remainOutputStart, iBuilder->getInt64(2))}));
     443    iBuilder->CreateStore(second_move_left_2_byte, iBuilder->CreateGEP(i8output_ptr, iBuilder->CreateAdd(remainOutputStart, iBuilder->getInt64(2))));
    444444    iBuilder->CreateBr(fbExit);
    445445
    446446    iBuilder->SetInsertPoint(handleNoRemainSecondByte);
    447     iBuilder->CreateStore(first_move_left_4_byte, iBuilder->CreateGEP(i8output_ptr, {iBuilder->CreateAdd(remainOutputStart, iBuilder->getInt64(1))}));
     447    iBuilder->CreateStore(first_move_left_4_byte, iBuilder->CreateGEP(i8output_ptr, iBuilder->CreateAdd(remainOutputStart, iBuilder->getInt64(1))));
    448448    iBuilder->CreateBr(fbExit);
    449449
     
    559559    iBuilder->SetInsertPoint(doPadding);
    560560    Value * i8output_ptr = iBuilder->CreatePointerCast(base64stream_ptr, iBuilder->getInt8PtrTy());
    561     iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt8Ty(), '='), iBuilder->CreateGEP(i8output_ptr, {remainingBytes}));
     561    iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt8Ty(), '='), iBuilder->CreateGEP(i8output_ptr, remainingBytes));
    562562    iBuilder->CreateCondBr(iBuilder->CreateICmpEQ(remainMod4, iBuilder->getSize(3)), fbExit, doPadding2);
    563563    iBuilder->SetInsertPoint(doPadding2);
    564564    Value * finalPadPos = iBuilder->CreateAdd(remainingBytes, iBuilder->getSize(1));
    565     iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt8Ty(), '='), iBuilder->CreateGEP(i8output_ptr, {finalPadPos}));
     565    iBuilder->CreateStore(ConstantInt::get(iBuilder->getInt8Ty(), '='), iBuilder->CreateGEP(i8output_ptr, finalPadPos));
    566566    iBuilder->CreateBr(fbExit);
    567567    iBuilder->SetInsertPoint(fbExit);
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5238 r5240  
    124124    Value * handle = iBuilder->CreateGEP(bufferStructPtr, {iBuilder->getInt32(0), iBuilder->getInt32(iBuffer_ptr)});
    125125    Value * bufPtr = iBuilder->CreateLoad(handle);
    126     return iBuilder->CreateGEP(bufPtr, {iBuilder->CreateSub(blockNo, consumerBlock)});
     126    return iBuilder->CreateGEP(bufPtr, iBuilder->CreateSub(blockNo, consumerBlock));
    127127}
    128128
     
    174174    Value * bufferPtr = iBuilder->CreateLoad(handle);
    175175    Value * const consumerBlock = iBuilder->CreateUDiv(consumerPos, blockWidth);
    176     Value * copyFrom = iBuilder->CreateGEP(bufferPtr, {iBuilder->CreateSub(new_consumer_block, consumerBlock)});
     176    Value * copyFrom = iBuilder->CreateGEP(bufferPtr, iBuilder->CreateSub(new_consumer_block, consumerBlock));
    177177    Value * alignment = ConstantInt::get(iBuilder->getInt32Ty(), iBuilder->getBitBlockWidth() / 8);
    178178   
  • icGREP/icgrep-devel/icgrep/kernels/symboltablepipeline.cpp

    r5234 r5240  
    729729    remainingBytes3->addIncoming(bufferSize, partialLeadingCond);
    730730    remainingBytes3->addIncoming(remainingBytes2, regularCondBlock);
    731     Value * partialBlockCond = iBuilder->CreateICmpSGT(remainingBytes3, iBuilder->getSize(0);
     731    Value * partialBlockCond = iBuilder->CreateICmpSGT(remainingBytes3, iBuilder->getSize(0));
    732732    iBuilder->CreateCondBr(partialBlockCond, partialBodyBlock, flushLengthGroupsBlock);
    733733
Note: See TracChangeset for help on using the changeset viewer.