SIRToStreamIt.run(fused);
    public static SIRStream fuse(SIRSplitJoin sj)    {        if (!isFusable(sj)) {            return sj;        } else {            //System.err.println("Fusing " + (sj.size()) + " SplitJoin filters.");        }        //printStats(sj);        // get copy of child streams        List children = sj.getParallelStreams();        // rename components        doRenaming(children);        // inline phases        doPhaseInlining(children);        // calculate the repetitions for the split-join        SRepInfo rep = SRepInfo.calcReps(sj);        // So at this point we have an eligible split/join; flatten it.        JMethodDeclaration newWork = makeWorkFunction(sj, children, rep);        JFieldDeclaration[] newFields = makeFields(sj, children);        JMethodDeclaration[] newMethods = makeMethods(sj, children);        JMethodDeclaration newInit = makeInitFunction(sj, children);        SRate rate = calcSRate(sj, rep);        // Build the new filter.        SIRFilter newFilter;        if (!childrenAreIdentities(sj)) {            // only need to perform normal fusion if some child filter            // is not an identity            newFilter = new SIRFilter(sj.getParent(), "Fused_" + sj.getIdent(),                                      newFields, newMethods, new JIntLiteral(rate.peek),                                      new JIntLiteral(rate.pop), new JIntLiteral(rate.push),                                      newWork, sj.getInputType(), sj.getOutputType());            // Use the new init function            newFilter.setInit(newInit);        } else {            // if all children identities, need an expander in the            // case of a duplicate splitter and nothing otherwise            if (sj.getSplitter().getType()==SIRSplitType.DUPLICATE) {                newFilter = buildExpander(sj.size(), rep.child[0], sj.getInputType());            } else {                // don't need any fused filter; we use an identity as a placeholder                newFilter = new SIRIdentity(sj.getInputType());            }        }        // make new pipeline representing fused sj        SIRPipeline fused = makeFusedPipe(sj, rep, rate, newFilter);        // replace in parent        replaceInParent(sj, fused);        // uncomment this if you want to see what the output of fusion looks like        SIRToStreamIt.run(fused);        return fused;    }