Ignore:
Timestamp:
Sep 8, 2015, 9:44:05 AM (4 years ago)
Author:
nmedfort
Message:

More work on reassociation pass

File:
1 edited

Legend:

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

    r4650 r4764  
    2121    // of it.
    2222
    23     for (PabloAST * assign : mDefined) {
    24         assign->addUser(this);
    25         addUser(assign);
     23    for (PabloAST * def : mDefined) {
     24        def->addUser(this);
     25        addUser(def);
    2626    }
    2727}
     
    3232, mDefined(definedVars.begin(), definedVars.end(), reinterpret_cast<DefinedAllocator &>(mVectorAllocator))
    3333{
    34     for (PabloAST * assign : mDefined) {
    35         assign->addUser(this);
    36         addUser(assign);
     34    for (PabloAST * def : mDefined) {
     35        def->addUser(this);
     36        addUser(def);
    3737    }
    3838}
    3939
     40void If::addDefined(Assign * def) {
     41    if (LLVM_LIKELY(std::find(mDefined.begin(), mDefined.end(), def) != mDefined.end())) {
     42        const auto size = mDefined.size();
     43        mDefined.push_back(def);
     44        assert (mDefined.size() == size + 1);
     45        assert (mDefined.back() == def);
     46        def->addUser(this);
     47        addUser(def);
     48    }
     49}
    4050
    4151}
Note: See TracChangeset for help on using the changeset viewer.