Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 70629 invoked from network); 16 Nov 2006 12:55:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Nov 2006 12:55:47 -0000 Received: (qmail 28565 invoked by uid 500); 16 Nov 2006 12:55:56 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 28538 invoked by uid 500); 16 Nov 2006 12:55:56 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 28527 invoked by uid 99); 16 Nov 2006 12:55:56 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Nov 2006 04:55:56 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Nov 2006 04:55:44 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 0F52C1A9846; Thu, 16 Nov 2006 04:55:13 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r475716 - in /incubator/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/ssa: SSA.cpp SSA.h Date: Thu, 16 Nov 2006 12:55:12 -0000 To: harmony-commits@incubator.apache.org From: varlax@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061116125513.0F52C1A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 &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 *changedVars, StlVector *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);