Changeset 4695


Ignore:
Timestamp:
Jul 23, 2015, 11:17:02 PM (4 years ago)
Author:
nmedfort
Message:

Bug fixes for last check in.

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
3 edited

Legend:

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

    r4692 r4695  
    9393
    9494PabloAST * PabloBuilder::createAnd(PabloAST * expr1, PabloAST * expr2) {
    95     if (expr1 < expr2) {
     95    if (isa<Not>(expr1) || expr1 > expr2) {
    9696        std::swap(expr1, expr2);
    9797    }
     
    101101
    102102PabloAST * PabloBuilder::createAnd(PabloAST * expr1, PabloAST * expr2, const std::string prefix) {
    103     if (expr1 < expr2) {
     103    if (isa<Not>(expr1) || expr1 > expr2) {
    104104        std::swap(expr1, expr2);
    105105    }
     
    109109
    110110PabloAST * PabloBuilder::createOr(PabloAST * expr1, PabloAST * expr2) {
    111     if (expr1 < expr2) {
     111    if (expr1 > expr2) {
    112112        std::swap(expr1, expr2);
    113113    }
     
    117117
    118118PabloAST * PabloBuilder::createOr(PabloAST * expr1, PabloAST * expr2, const std::string prefix) {
    119     if (expr1 < expr2) {
     119    if (expr1 > expr2) {
    120120        std::swap(expr1, expr2);
    121121    }
     
    125125
    126126PabloAST * PabloBuilder::createXor(PabloAST * expr1, PabloAST * expr2) {
    127     if (expr1 < expr2) {
     127    if (expr1 > expr2) {
    128128        std::swap(expr1, expr2);
    129129    }
     
    133133
    134134PabloAST * PabloBuilder::createXor(PabloAST * expr1, PabloAST * expr2, const std::string prefix) {
    135     if (expr1 < expr2) {
     135    if (expr1 > expr2) {
    136136        std::swap(expr1, expr2);
    137137    }
  • icGREP/icgrep-devel/icgrep/pablo/expression_map.hpp

    r4692 r4695  
    264264            case PabloAST::ClassTypeId::Or:
    265265            case PabloAST::ClassTypeId::Xor:
     266                // test whether the communative version of this statement exists
     267                if (PabloAST * commExpr = mBinary.find(stmt->getClassTypeId(), stmt->getOperand(1), stmt->getOperand(0))) {
     268                    return std::make_pair(commExpr, false);
     269                }
    266270            case PabloAST::ClassTypeId::Advance:
    267271            case PabloAST::ClassTypeId::ScanThru:
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_automultiplexing.cpp

    r4692 r4695  
    101101bool AutoMultiplexing::optimize(PabloFunction & function) {
    102102
    103     std::random_device rd;
    104     const auto seed = rd(); // 83234827342;
     103    // std::random_device rd;
     104    const auto seed = 83234827342;
    105105    RNG rng(seed);
    106106
     
    443443    if (LLVM_UNLIKELY(NoSatisfyingAssignment(bdd))) {
    444444        Deref(bdd);
    445         // If there is no satisfing assignment for this bdd, the statement will always produce
    446         // 0. If this is an Assign or Next node, replace the value with 0. Otherwise replace
    447         // the statement with 0.
    448         if (LLVM_UNLIKELY(isa<Assign>(stmt) || isa<Next>(stmt))) {
     445        // If there is no satisfing assignment for this bdd, the statement will always produce 0.
     446        // We can safely replace this statement with 0 unless it is an Advance, Assign or Next node.
     447        // Those must be handled specially or we may end up producing a non-equivalent function.
     448        if (LLVM_UNLIKELY(isa<Advance>(stmt) || isa<Assign>(stmt) || isa<Next>(stmt))) {
    449449            stmt->setOperand(0, stmt->getParent()->createZeroes());
    450450        }
Note: See TracChangeset for help on using the changeset viewer.