Index: jitrino/src/codegenerator/ia32/Ia32DCE.cpp =================================================================== --- jitrino/src/codegenerator/ia32/Ia32DCE.cpp (revision 585899) +++ jitrino/src/codegenerator/ia32/Ia32DCE.cpp (working copy) @@ -59,6 +59,27 @@ for (Nodes::const_iterator it = nodes.begin(),end = nodes.end();it!=end; ++it) { Node* node = *it; if (node->isBlockNode()){ + //remove conditional jumps in case if true and false node + //check is last instruction in basic block is a conditional branch instruction + Inst * inst = (Inst *)node->getLastInst(); + if(inst && node->getOutEdges().size() > 1) { + Edges edges = node->getOutEdges(); + for (Edges::const_iterator ite = edges.begin(), end = edges.end(); ite != end; ++ite) { + Edge *edge1 = *ite; + Edge *edge2 = node->getOutEdge(edge1->getKind()); + if ((edge1 != edge2) && (edge1->getTargetNode() == edge2->getTargetNode())) { + //If this condition is satisfied then we have several branches with + //the same kind and the same destination + assert(edge1->getKind() == Edge::Kind::Kind_True || edge1->getKind() == Edge::Kind::Kind_False); + assert(inst->hasKind(Inst::Kind_BranchInst)); + if (inst->hasKind(Inst::Kind_BranchInst)) { + inst->unlink(); + irManager->getFlowGraph()->removeEdge(edge1); + } + } + } + } + irManager->getLiveAtExit(node, ls); for (Inst * inst=(Inst*)node->getLastInst(), * prevInst=NULL; inst!=NULL; inst=prevInst){ prevInst=inst->getPrevInst();