Ignore:
Timestamp:
Dec 1, 2015, 5:13:00 PM (4 years ago)
Author:
nmedfort
Message:

Bug fixes

File:
1 edited

Legend:

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

    r4885 r4886  
    77#include <boost/container/flat_map.hpp>
    88#include <boost/graph/adjacency_list.hpp>
    9 
    10 #include <pablo/printer_pablos.h>
    11 #include <iostream>
    129
    1310using namespace boost;
     
    335332        block->setInsertPoint(cast<Variadic>(G[sinks.front()])->getPrevNode());
    336333        if (isa<And>(G[sinks.front()])) {
    337             outerOp = block->createAnd(intermediary.size(), PabloBlock::createOnes());
    338             innerOp = block->createOr(sources.size() + 1, outerOp);
     334            outerOp = block->createAnd(intermediary.size());
     335            innerOp = block->createOr(sources.size() + 1);
    339336        } else {
    340             outerOp = block->createOr(intermediary.size(), PabloBlock::createZeroes());
    341             innerOp = block->createAnd(sources.size() + 1, outerOp);
    342         }
    343 
    344         unsigned i = 0;
     337            outerOp = block->createOr(intermediary.size());
     338            innerOp = block->createAnd(sources.size() + 1);
     339        }
     340
    345341        for (const Vertex u : intermediary) {
    346342            for (const Vertex v : sinks) {
    347343                cast<Variadic>(G[v])->deleteOperand(G[u]);
    348344            }
    349             outerOp->setOperand(i++, cast<Variadic>(G[u]));
    350         }
    351 
    352         i = 0;
     345            outerOp->addOperand(G[u]);
     346        }
     347
    353348        for (const Vertex u : sources) {
    354349            for (const Vertex v : intermediary) {
    355350                cast<Variadic>(G[v])->deleteOperand(G[u]);
    356351            }
    357             innerOp->setOperand(i++, G[u]);
    358         }
     352            innerOp->addOperand(G[u]);
     353        }
     354        innerOp->addOperand(outerOp);
     355
    359356        for (const Vertex u : sinks) {
    360357            cast<Variadic>(G[u])->addOperand(innerOp);
     
    387384    PabloVerifier::verify(function, "post-distribution");
    388385    #endif
     386
    389387    Simplifier::optimize(function);
    390388    return modified;
Note: See TracChangeset for help on using the changeset viewer.