You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2006/11/16 13:55:12 UTC

svn commit: r475716 - in /incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa: SSA.cpp SSA.h

Author: varlax
Date: Thu Nov 16 04:55:12 2006
New Revision: 475716

URL: http://svn.apache.org/viewvc?view=rev&rev=475716
Log:
Applied HARMONY-1905 [drlvm][opt] assertion fails in DeadCodeEliminator
Tested on SUSE9

Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.h

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.cpp?view=diff&rev=475716&r1=475715&r2=475716
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.cpp Thu Nov 16 04:55:12 2006
@@ -103,6 +103,29 @@
     {};
 };
 
+
+// Checks that phi insts can start from the second or third position only
+// and goes in a row
+bool SSABuilder::phiInstsOnRightPositionsInBB(Node* node) {
+    Inst* inst = (Inst*)node->getSecondInst();
+    if(inst && !inst->isPhi()) {
+        // try the next one (third)
+        inst = inst->getNextInst();
+    }
+    // skip all phis
+    while ( inst!=NULL && inst->isPhi() ) {
+        inst = inst->getNextInst();
+    }
+    // 'true' only if there is no any other phis in the node
+    while ( inst!=NULL ) {
+        if(inst->isPhi()) {
+            return false;
+        }
+        inst = inst->getNextInst();
+    }
+    return true;
+} 
+
 //
 // find def sites (blocks) of var operand
 //
@@ -601,7 +624,16 @@
 bool SSABuilder::checkForTrivialPhis(Node *node, 
                                      StlVector<VarOpnd *> &changedVars)
 {
+    // Check that phi insts can start from the second or third position only
+    // and goes in a row
+    assert(phiInstsOnRightPositionsInBB(node));
+
     Inst* phi = (Inst*)node->getSecondInst();
+    if(phi && !phi->isPhi()) {
+        // try the next one (third)
+        phi = phi->getNextInst();
+    }
+
     bool removedPhi = false;
 #ifdef DEBUG_SSA
     if (Log::isEnabled()) {
@@ -669,7 +701,16 @@
                                       StlVector<VarOpnd *> *changedVars,
                                       StlVector<Opnd *> *removedVars)
 {
+    // Check that phi insts can start from the second or third position only
+    // and goes in a row
+    assert(phiInstsOnRightPositionsInBB(node));
+
     Inst* phi = (Inst*)node->getSecondInst();
+    if(phi && !phi->isPhi()) {
+        // try the next one (third)
+        phi = phi->getNextInst();
+    }
+
     Inst *nextphi = NULL;
 #ifdef DEBUG_SSA
     if (Log::isEnabled()) {

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.h?view=diff&rev=475716&r1=475715&r2=475716
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa/SSA.h Thu Nov 16 04:55:12 2006
@@ -105,6 +105,7 @@
     bool fixupVars(ControlFlowGraph* fg, MethodDesc& methodDesc);
     static void deconvertSSA(ControlFlowGraph* fg,OpndManager& opndManager);
     static void splitSsaWebs(ControlFlowGraph* fg,OpndManager& opndManager);
+    static bool phiInstsOnRightPositionsInBB(Node* node);
 private:
     void findDefSites(DefSites& allDefSites);
     void insertPhi(DefSites& allDefSites);