Ignore:
Timestamp:
Sep 15, 2015, 4:27:23 PM (4 years ago)
Author:
nmedfort
Message:

Bug fixes for reassociation pass; passes make check.

File:
1 edited

Legend:

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

    r4766 r4771  
    2626};
    2727
    28 void isTopologicallyOrdered(const PabloBlock & block, const OrderingVerifier & parent) {
     28void isTopologicallyOrdered(const PabloBlock & block, const OrderingVerifier & parent, const bool ignoreUnusedStatements) {
    2929    OrderingVerifier ov(parent);
    3030    for (const Statement * stmt : block) {
     31        if (stmt->getNumUses() == 0 && ignoreUnusedStatements) {
     32            continue;
     33        }
     34        if (LLVM_UNLIKELY(isa<While>(stmt))) {
     35            isTopologicallyOrdered(cast<While>(stmt)->getBody(), ov, ignoreUnusedStatements);
     36            for (const Next * var : cast<While>(stmt)->getVariants()) {
     37                ov.insert(var);
     38            }
     39        }
    3140        for (unsigned i = 0; i != stmt->getNumOperands(); ++i) {
    3241            const PabloAST * op = stmt->getOperand(i);
     
    4453        ov.insert(stmt);
    4554        if (LLVM_UNLIKELY(isa<If>(stmt))) {
    46             isTopologicallyOrdered(cast<If>(stmt)->getBody(), ov);
     55            isTopologicallyOrdered(cast<If>(stmt)->getBody(), ov, ignoreUnusedStatements);
    4756            for (const Assign * def : cast<If>(stmt)->getDefined()) {
    4857                ov.insert(def);
    49             }
    50         } else if (LLVM_UNLIKELY(isa<While>(stmt))) {
    51             isTopologicallyOrdered(cast<While>(stmt)->getBody(), ov);
    52             for (const Next * var : cast<While>(stmt)->getVariants()) {
    53                 ov.insert(var);
    5458            }
    5559        }
     
    5761}
    5862
    59 void isTopologicallyOrdered(const PabloFunction & function) {
     63void isTopologicallyOrdered(const PabloFunction & function, const bool ignoreUnusedStatements) {
    6064    OrderingVerifier ov;
    6165    for (unsigned i = 0; i != function.getNumOfParameters(); ++i) {
    6266        ov.insert(function.getParameter(i));
    6367    }
    64     isTopologicallyOrdered(function.getEntryBlock(), ov);
     68    isTopologicallyOrdered(function.getEntryBlock(), ov, ignoreUnusedStatements);
    6569}
    6670
    67 void PabloVerifier::verify(const PabloFunction & function) {
    68     isTopologicallyOrdered(function);
     71void PabloVerifier::verify(const PabloFunction & function, const bool ignoreUnusedStatements) {
     72    isTopologicallyOrdered(function, ignoreUnusedStatements);
    6973}
    7074
Note: See TracChangeset for help on using the changeset viewer.