Ignore:
Timestamp:
Jun 4, 2015, 4:28:10 PM (4 years ago)
Author:
nmedfort
Message:

Added ability to infer mutual exclusivity / subset relationships based on already proven relationships. Simplifer can now eliminate If nodes whenever all of the defined vars are Zeroes.

File:
1 edited

Legend:

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

    r4592 r4594  
    185185        mOperand[i]->removeUser(this);
    186186    }
     187    // If this is an If or While statement, we'll have to remove the statements within the
     188    // body or we'll lose track of them.
     189    if (LLVM_UNLIKELY(isa<If>(this) || isa<While>(this))) {
     190        if (isa<If>(this)) {
     191            // Eliminate the relationship between the If node and its defined vars ...
     192            for (PabloAST * var : cast<If>(this)->getDefined()) {
     193                var->removeUser(this);
     194                this->removeUser(var);
     195                var->replaceAllUsesWith(mParent->createZeroes());
     196            }
     197        }
     198        PabloBlock & body = isa<If>(this) ? cast<If>(this)->getBody() : cast<While>(this)->getBody();
     199        Statement * stmt = body.front();
     200        while (stmt) {
     201            stmt = stmt->eraseFromParent(recursively);
     202        }
     203    }
     204
    187205    if (recursively) {
    188206        for (auto i = 0; i != mOperands; ++i) {
Note: See TracChangeset for help on using the changeset viewer.