harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfur...@apache.org
Subject svn commit: r594094 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src: optimizer/FlowGraph.cpp optimizer/FlowGraph.h optimizer/Loop.cpp optimizer/Opnd.h optimizer/loop_unroll.cpp shared/unionfind.h
Date Mon, 12 Nov 2007 12:22:09 GMT
Author: mfursov
Date: Mon Nov 12 04:22:08 2007
New Revision: 594094

URL: http://svn.apache.org/viewvc?rev=594094&view=rev
Log:
Fix for HARMONY-4984 [drlvm][jit] Flowgraph:duplicateRegion doesn't support SSA form
Fixing the rank order in jitrino/src/optimizer/unionfind.h


Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Loop.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opnd.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/loop_unroll.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/unionfind.h

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp?rev=594094&r1=594093&r2=594094&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp Mon Nov 12 04:22:08
2007
@@ -113,7 +113,7 @@
     return copy;
 }
 
-static Node* duplicateNode(IRManager& irm, Node *source, Node *before, OpndRenameTable
*renameTable) {
+Node* FlowGraph::duplicateNode(IRManager& irm, Node *source, Node *before, OpndRenameTable
*renameTable) {
     Node *newblock;
     LabelInst *first = (LabelInst*)source->getFirstInst();
     if(Log::isEnabled()) {
@@ -150,8 +150,9 @@
 }
 
 
-static Node* duplicateNode(IRManager& irm, Node *node, StlBitVector* nodesInRegion, 
-                           DefUseBuilder* defUses, OpndRenameTable* opndRenameTable) 
+Node* FlowGraph::duplicateNode(IRManager& irm, Node *node, StlBitVector* nodesInRegion,

+                           DefUseBuilder* defUses, OpndRenameTable* opndRenameTable,
+                           NodeRenameTable* reverseNodeRenameTable) 
 {
     if(Log::isEnabled()) {
         Log::out() << "DUPLICATE NODE " << std::endl;
@@ -167,6 +168,7 @@
     LabelInst* l = (LabelInst*)instFactory.clone(first,opndManager,opndRenameTable);
     newNode  = fg.createNode(node->getKind(), l);
     l->setState(first->getState());
+    reverseNodeRenameTable->setMapping(newNode, node);
 
     // Copy edges
     const Edges& outEdges = node->getOutEdges();
@@ -189,35 +191,62 @@
             Log::out().flush();
         }
 
+        // Create clone inst, add to new node, and update defuse links.
+        Inst* newInst = instFactory.clone(inst,opndManager,opndRenameTable);
+        
+        // Special care required for SSA operands.
         Opnd* dst = inst->getDst();
         if(dst->isSsaOpnd()) {
-            assert(!dst->isSsaVarOpnd());
-
-            //
             // Determine if dst should be promoted to a var.
-            //
-            ConstInst* ci = inst->asConstInst();
-            VarOpnd* var = NULL;
-            DefUseLink* duLink = defUses->getDefUseLinks(inst);
-            for(; duLink != NULL; duLink = duLink->getNext()) {
+            Opnd* var = NULL;
+            SsaVarOpnd* srcVar1 = NULL;
+            SsaVarOpnd* srcVar2 = NULL;
+            DefUseLink* duLink = NULL;
+
+            for(duLink = defUses->getDefUseLinks(inst); duLink != NULL; duLink = duLink->getNext())
{
+                int index = duLink->getSrcIndex();
                 Inst* useInst = duLink->getUseInst();
+                Node* useNode = useInst->getNode();
+                assert(useNode != NULL);
+                
                 if(Log::isEnabled()) {
                     Log::out() << "Examine use: ";
                     useInst->print(Log::out());
                     Log::out() << std::endl;
                 }
-                Node* useNode = useInst->getNode();
-                assert(useNode != NULL);
-                if(!nodesInRegion->getBit(useNode->getId())) {
-                    //
-                    // Need to promote dst.
-                    //
+                
+                // No special actions for nodes to be clonned.
+                if (nodesInRegion->getBit(useNode->getId())) continue;
+
+                // Handle variables.
+                if (dst->isSsaVarOpnd()) {
+                    defUses->removeDefUse(inst, useInst, index);
+                    // Handle cyclic dependence.
+                    if (reverseNodeRenameTable->getMapping(useNode) != NULL) {
+                        // There is already phi insturction.
+                        // Just update source operand.
+                        useInst->setSrc(index, newInst->getDst());
+                        defUses->addDefUse(newInst, useInst, index);
+                        continue;
+                    }
+                    // Insert phi instruction.
+                    srcVar1 = inst->getDst()->asSsaVarOpnd();
+                    srcVar2 = newInst->getDst()->asSsaVarOpnd();
+                    StlBitVector visitedNodes = StlBitVector(irm.getMemoryManager(), fg.getMaxNodeId(),
false); 
+                    Inst* phiInst = insertPhi(irm, nodesInRegion, reverseNodeRenameTable,
+                        visitedNodes, useNode, defUses, srcVar1, srcVar2);
+                    useInst->setSrc(index, phiInst->getDst());
+                    defUses->addDefUse(phiInst, useInst, index);                    
+                } else {
+                    assert(!dst->isVarOpnd() && !dst->isSsaVarOpnd());
+                    // Need to promote dst to variable.
                     if(Log::isEnabled()) {
                         Log::out() << "Patch use: ";
                         useInst->print(Log::out());
                         Log::out() << std::endl;
                     }
                     Inst* patchdef = NULL;
+                    ConstInst* ci = inst->asConstInst();
                     if(ci != NULL) {
                         MemoryManager mm("FlowGraph::duplicateNode.mm");
                         OpndRenameTable table(mm,1);
@@ -226,7 +255,12 @@
                     } else {
                         if(var == NULL) {
                             var = opndManager.createVarOpnd(dst->getType(), false);
-                            Inst* stVar = instFactory.makeStVar(var, dst);
+                            if (irm.getInSsa()) {
+                                var = opndManager.createSsaVarOpnd(var->asVarOpnd());
+                            }
+
+                            Inst* stVar = irm.getInSsa() ? instFactory.makeStVar(var->asSsaVarOpnd(),
dst)
+                                : instFactory.makeStVar(var->asVarOpnd(), dst);
                             if(inst->getOperation().canThrow()) {
                                 LabelInst* lblInst = instFactory.makeLabel();
                                 assert(inst->getBCOffset()!=ILLEGAL_BC_MAPPING_VALUE);
@@ -249,29 +283,27 @@
                         }
 
                         Opnd* newUse = opndManager.createSsaTmpOpnd(dst->getType());
-                        patchdef = instFactory.makeLdVar(newUse, var);
+                        patchdef = irm.getInSsa() ?  instFactory.makeLdVar(newUse, var->asSsaVarOpnd())
+                            : instFactory.makeLdVar(newUse, var->asVarOpnd());
                     }
 
                     //
                     // Patch useInst to load from var.
                     //
-                    uint32 srcNum = duLink->getSrcIndex();
                     patchdef->insertBefore(useInst);
                     defUses->addUses(patchdef);
-                    useInst->setSrc(srcNum, patchdef->getDst());
+                    useInst->setSrc(index, patchdef->getDst());
 
                     //
                     // Update def-use chains.
                     //
-                    defUses->removeDefUse(inst, useInst, srcNum);
-                    defUses->addDefUse(patchdef, useInst, srcNum);
+                    defUses->removeDefUse(inst, useInst, index);
+                    defUses->addDefUse(patchdef, useInst, index);
                 }
             }
         }
-
-        // Create clone inst, add to new node, and update defuse links.
-        Inst* newInst = instFactory.clone(inst,opndManager,opndRenameTable);
-        newNode->appendInst(newInst);
+        
+        newNode->appendInst(newInst);        
         defUses->addUses(newInst);
     }
     if(Log::isEnabled()) {
@@ -281,15 +313,82 @@
     return newNode;
 }
 
+Inst* FlowGraph::insertPhi(IRManager& irm, StlBitVector* nodesInRegion,
+                           NodeRenameTable* reverseNodeRenameTable,
+                           StlBitVector& visitedNodes,
+                           Node* useNode, DefUseBuilder* defUses,
+                           SsaVarOpnd* srcVar1, SsaVarOpnd* srcVar2) {
+    Inst* phiInst = NULL;
+    std::set<SsaVarOpnd*> phiOpnds;
+    
+    // Check if we already visited this node.
+    if (visitedNodes.getBit(useNode->getId())) {
+        return NULL;
+    }
+    
+    // Mark node as visited.
+    visitedNodes.setBit(useNode->getId(), true);
+    
+    // Find in values throug all eges.
+    const Edges& inEdges = useNode->getInEdges();
+    for (Edges::const_iterator it = inEdges.begin(), end = inEdges.end(); it != end; it++)
{
+        Edge* inEdge = *it;
+        if (nodesInRegion->getBit(inEdge->getSourceNode()->getId())) {
+            phiOpnds.insert(phiOpnds.end(), srcVar1);
+            phiOpnds.insert(phiOpnds.end(), srcVar2);            
+        } else if (!reverseNodeRenameTable->getMapping(inEdge->getSourceNode())){
+            Inst* phi = insertPhi(irm, nodesInRegion, reverseNodeRenameTable,
+                visitedNodes, inEdge->getSourceNode(), defUses, srcVar1, srcVar2);
+            if (phi != NULL) {
+                phiOpnds.insert(phiOpnds.end(), phi->getDst()->asSsaVarOpnd());
+            }
+        }
+    }
+    
+    // Merge input values.
+    if (phiOpnds.size() == 1) {
+        phiInst = (*phiOpnds.begin())->getInst();
+    } else if (phiOpnds.size() > 1) {
+        Opnd** opnds = (Opnd**)irm.getMemoryManager().alloc(sizeof(Opnd*) * phiOpnds.size());

+        std::copy(phiOpnds.begin(), phiOpnds.end(), opnds);
+        phiInst = findPhi(useNode, opnds, phiOpnds.size());
+        if (phiInst == NULL) {
+            SsaVarOpnd* dst = irm.getOpndManager().createSsaVarOpnd(srcVar1->getVar());
+            phiInst = irm.getInstFactory().makePhi(dst, phiOpnds.size(), opnds);
+            useNode->prependInst(phiInst);
+            defUses->addUses(phiInst);
+        }
+    }
+    return phiInst;
+}
+
+Inst* FlowGraph::findPhi(Node* node, Opnd** opnds, int opndsCount) {
+    
+    for (Inst* inst = (Inst*)node->getFirstInst(); inst != NULL; inst = inst->getNextInst())
{        
+        if (inst->getOpcode() == Op_Phi && inst->getNumSrcOperands() == (uint32)opndsCount)
{
+            for (int i = 0; i < opndsCount; i++) {
+                if (inst->getSrc(i) != opnds[i]) {
+                    break;
+                }
+                return inst;
+            }
+        }
+    }
+    return NULL;
+}
 
-
-static Node* _duplicateRegion(IRManager& irm, Node* node, Node* entry, StlBitVector&
nodesInRegion, DefUseBuilder* defUses, NodeRenameTable* nodeRenameTable, OpndRenameTable*
opndRenameTable) {
+Node* FlowGraph::_duplicateRegion(IRManager& irm, Node* node, Node* entry,
+                              StlBitVector& nodesInRegion,
+                              DefUseBuilder* defUses,
+                              NodeRenameTable* nodeRenameTable,
+                              NodeRenameTable* reverseNodeRenameTable,
+                              OpndRenameTable* opndRenameTable) {
     assert(nodesInRegion.getBit(node->getId()));
     Node* newNode = nodeRenameTable->getMapping(node);
     if(newNode != NULL)
         return newNode;
 
-    newNode = duplicateNode(irm, node, &nodesInRegion, defUses, opndRenameTable);
+    newNode = duplicateNode(irm, node, &nodesInRegion, defUses, opndRenameTable, reverseNodeRenameTable);
     nodeRenameTable->setMapping(node, newNode);
 
     ControlFlowGraph& fg = irm.getFlowGraph();
@@ -298,9 +397,13 @@
     for(eiter = outEdges.begin(); eiter != outEdges.end(); ++eiter) {
         Edge* edge = *eiter;
         Node* succ = edge->getTargetNode();
-        if(succ != entry && nodesInRegion.getBit(succ->getId())) {
-            Node* newSucc = _duplicateRegion(irm, succ, entry, nodesInRegion, defUses, nodeRenameTable,
opndRenameTable);
-            assert(newSucc != NULL);
+        if(nodesInRegion.getBit(succ->getId())) {
+            Node* newSucc = nodeRenameTable->getMapping(succ); 
+            if (newSucc == NULL) {
+                newSucc = _duplicateRegion(irm, succ, entry, nodesInRegion,
+                    defUses, nodeRenameTable, reverseNodeRenameTable, opndRenameTable);
+                assert(newSucc != NULL);
+            }
             fg.replaceEdgeTarget(newNode->findTargetEdge(succ), newSucc, true);
         }
     }    
@@ -309,8 +412,16 @@
 }
 
 
-Node* FlowGraph::duplicateRegion(IRManager& irm, Node* entry, StlBitVector& nodesInRegion,
DefUseBuilder& defUses, NodeRenameTable& nodeRenameTable, OpndRenameTable& opndRenameTable,
double newEntryFreq) {
-    Node* newEntry = _duplicateRegion(irm, entry, entry, nodesInRegion, &defUses, &nodeRenameTable,
&opndRenameTable);
+Node* FlowGraph::duplicateRegion(IRManager& irm, Node* entry,
+                                 StlBitVector& nodesInRegion,
+                                 DefUseBuilder& defUses,
+                                 NodeRenameTable& nodeRenameTable,                  
              
+                                 OpndRenameTable& opndRenameTable,
+                                 double newEntryFreq) {
+    NodeRenameTable* reverseNodeRenameTable = new (irm.getMemoryManager()) 
+        NodeRenameTable(irm.getMemoryManager(), nodesInRegion.size());     
+    Node* newEntry = _duplicateRegion(irm, entry, entry, nodesInRegion,
+        &defUses, &nodeRenameTable, reverseNodeRenameTable, &opndRenameTable);
     if(newEntryFreq == 0) {
         return newEntry;
     }
@@ -330,8 +441,8 @@
 Node* FlowGraph::duplicateRegion(IRManager& irm, Node* entry, StlBitVector& nodesInRegion,
DefUseBuilder& defUses, double newEntryFreq) {
     MemoryManager dupMemManager("FlowGraph::duplicateRegion.dupMemManager");
     // prepare the hashtable for the operand rename translation
-    OpndRenameTable    *opndRenameTable = new (dupMemManager) OpndRenameTable(dupMemManager,10);
-    NodeRenameTable *nodeRenameTable = new (dupMemManager) NodeRenameTable(dupMemManager,10);
+    OpndRenameTable    *opndRenameTable = new (dupMemManager) OpndRenameTable(dupMemManager,
nodesInRegion.size());
+    NodeRenameTable *nodeRenameTable = new (dupMemManager) NodeRenameTable(dupMemManager,
nodesInRegion.size());
     return duplicateRegion(irm, entry, nodesInRegion, defUses, *nodeRenameTable, *opndRenameTable,
newEntryFreq);
 }
 
@@ -679,7 +790,7 @@
 }
 
 // Finally inlining
-static bool _inlineFinally(IRManager& irm, Node *from, Node *to, Node *retTarget,
+bool FlowGraph::_inlineFinally(IRManager& irm, Node *from, Node *to, Node *retTarget,
                             NodeRenameTable *nodeRenameTable,
                             OpndRenameTable *opndRenameTable) {
     // if the node has been visited, return
@@ -721,7 +832,7 @@
 }
 
 
-static bool inlineFinally(IRManager& irm, Node *block) {
+bool FlowGraph::inlineFinally(IRManager& irm, Node *block) {
     ControlFlowGraph& fg = irm.getFlowGraph();
     BranchInst* leaveInst  = (BranchInst*)block->getLastInst();
     Node *   retTarget  = leaveInst->getTargetLabel()->getNode();

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.h?rev=594094&r1=594093&r2=594094&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.h Mon Nov 12 04:22:08
2007
@@ -85,6 +85,29 @@
 
     static void printDotFile(ControlFlowGraph& cfg, MethodDesc& methodDesc,const
char *suffix);
 
+private:
+    static Node* duplicateNode(IRManager& irm, Node *source, Node *before, OpndRenameTable
*renameTable);
+    static Node* duplicateNode(IRManager& irm, Node *node, StlBitVector* nodesInRegion,

+                               DefUseBuilder* defUses, OpndRenameTable* opndRenameTable,
+                               NodeRenameTable* reverseNodeRenameTable); 
+    static Node* _duplicateRegion(IRManager& irm, Node* node, Node* entry,
+                                  StlBitVector& nodesInRegion,
+                                  DefUseBuilder* defUses,
+                                  NodeRenameTable* nodeRenameTable,
+                                  NodeRenameTable* reverseNodeRenameTable,
+                                  OpndRenameTable* opndRenameTable);
+
+    static Inst* insertPhi(IRManager& irm, StlBitVector* nodesInRegion,
+                           NodeRenameTable* reverseNodeRenameTable,
+                           StlBitVector& visitedNodes,
+                           Node* useNode, DefUseBuilder* defUses,
+                           SsaVarOpnd* srcVar1, SsaVarOpnd* srcVar2);
+    static Inst* findPhi(Node* node, Opnd** opnds, int opndsCount);
+    static bool _inlineFinally(IRManager& irm, Node *from, Node *to, Node *retTarget,
+                               NodeRenameTable *nodeRenameTable,
+                               OpndRenameTable *opndRenameTable);
+    static bool inlineFinally(IRManager& irm, Node *block);
+
 };
 
 class NodeRenameTable : public HashTable<Node,Node> {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Loop.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Loop.cpp?rev=594094&r1=594093&r2=594094&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Loop.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Loop.cpp Mon Nov 12 04:22:08 2007
@@ -384,8 +384,6 @@
 
     // Set def-use chains
     MemoryManager peelmem("LoopBuilder::peelLoops.peelmem");
-    DefUseBuilder defUses(peelmem);
-    defUses.initialize(irManager.getFlowGraph());
 
     OpndManager& opndManager = irManager.getOpndManager();
     InstFactory& instFactory = irManager.getInstFactory();
@@ -461,6 +459,8 @@
             Opcode op2 = ((Inst*)header->getLastInst())->getOpcode();
             if(flags.invert && (op1 != Op_Branch) && (op2 != Op_Branch))
{
                 if(isInversionCandidate(originalInvertedHeader, header, nodesInLoop, next,
exit)) {
+                    DefUseBuilder defUses(peelmem);
+                    defUses.initialize(fg);
                     preheader = FlowGraph::tailDuplicate(irManager, preheader, header, defUses);

                     tail = header;
                     header = next;
@@ -538,9 +538,17 @@
                 // Peel the nodes
                 //
                 if(newTail != NULL) {
+                    DefUseBuilder defUses(peelmem);
+                    defUses.initialize(fg);
                     Edge* entryEdge = preheader->findTargetEdge(originalInvertedHeader);
                     double peeledFreq = preheader->getExecCount() * entryEdge->getEdgeProb();

                     Node* peeled = FlowGraph::duplicateRegion(irManager, originalInvertedHeader,
nodesToPeel, defUses, peeledFreq);
+                    assert(peeled->getInDegree() <= 1);
+                    // Break cycle and link to original loop.
+                    if (peeled->getInDegree() == 1) {
+                        fg.replaceEdgeTarget(peeled->getInEdges().front(), header);
+                    }
+                    // Link duplicated region.
                     fg.replaceEdgeTarget(entryEdge, peeled);
                     if(newTail->findTargetEdge(header) == NULL) {
                         //

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opnd.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opnd.h?rev=594094&r1=594093&r2=594094&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opnd.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opnd.h Mon Nov 12 04:22:08 2007
@@ -310,7 +310,7 @@
 
 class OpndRenameTable : public HashTable<Opnd,Opnd> {
 public:
-    OpndRenameTable(MemoryManager& mm, uint32 size = 16, bool renameSSA = false): 
+    OpndRenameTable(MemoryManager& mm, uint32 size = 16, bool renameSSA = true): 
         HashTable<Opnd,Opnd>(mm,size) {renameSsaOpnd = renameSSA;}
     
     virtual ~OpndRenameTable() {}    

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/loop_unroll.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/loop_unroll.cpp?rev=594094&r1=594093&r2=594094&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/loop_unroll.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/loop_unroll.cpp Mon Nov 12 04:22:08
2007
@@ -687,14 +687,8 @@
         defUses.initialize(cfg);
         OpndRenameTable opndRenameTable(mm, maxNodeId); //todo: maxNodeId is overkill estimate
here
         NodeRenameTable nodeRenameTable(mm, maxNodeId);
-        epilogueLoopHead = FlowGraph::duplicateRegion(irm, checkNode, nodesInLoop, defUses,
nodeRenameTable, opndRenameTable);        
+        epilogueLoopHead = FlowGraph::duplicateRegion(irm, checkNode, nodesInLoop, defUses,
nodeRenameTable, opndRenameTable);
         cfg.replaceEdgeTarget(origLoopExitEdge, epilogueLoopHead, true);
-
-        //backedge was not duplicated -> this is a feature (Loop.cpp depends on it), find
using tailNode
-        Node* newTailNode = nodeRenameTable.getMapping(preCheckNode);
-        assert(newTailNode->getOutDegree() == 1 && newTailNode->getUnconditionalEdgeTarget()
== checkNode);
-        Edge* backedge = newTailNode->getUnconditionalEdge();
-        cfg.replaceEdgeTarget(backedge, epilogueLoopHead, true);
     }
 
     //STEP 5: prepare unrolledLimitOpnd and replace it in original loop's check
@@ -708,11 +702,12 @@
         info->branchInst->setSrc(info->branchLimitOpndPos, unrolledLimitOpnd);
     }
 
+    DefUseBuilder defUses(mm);
+    defUses.initialize(cfg);
     //STEP 6: unroll original loop and remove all checks in duplicated bodies
     {
         Edge* backedge = preCheckNode->getUnconditionalEdge();
         for (int i=1;i<info->unrollCount;i++) {
-            DefUseBuilder defUses(mm);
             OpndRenameTable opndRenameTable(mm, maxNodeId);
             NodeRenameTable nodeRenameTable(mm, maxNodeId);
 
@@ -722,9 +717,7 @@
             Node* newTail = nodeRenameTable.getMapping(preCheckNode);
             assert(newTail->getOutDegree()==1 );
             backedge = newTail->getUnconditionalEdge();
-            if (i>1) {
-                cfg.replaceEdgeTarget(backedge, checkNode, true);
-            }
+            cfg.replaceEdgeTarget(backedge, checkNode, true);
             
             //remove check from duplicated code
             Node* duplicateCheckNode = nodeRenameTable.getMapping(checkNode);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/unionfind.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/unionfind.h?rev=594094&r1=594093&r2=594094&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/unionfind.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/unionfind.h Mon Nov 12 04:22:08 2007
@@ -43,7 +43,7 @@
             aroot->parent = broot;
         } else {
             if (aroot->rank == broot->rank) {
-                broot->rank += 1;
+                aroot->rank += 1;
             }
             broot->parent = aroot;
         }



Mime
View raw message