From e756c96259dfddcaeb2240a8f551ce5be1c47f13 Mon Sep 17 00:00:00 2001
From: Vladimir Kozlov <kvn@openjdk.org>
Date: Tue, 13 Sep 2011 11:46:51 -0700
Subject: [PATCH] 7089632: assert(machtmp->outcnt() == 1) failed: expected for
 a MachTemp

Replace assert with check to delete MachTemp nodes only when they are really dead.

Reviewed-by: never
---
 hotspot/src/share/vm/opto/postaloc.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/hotspot/src/share/vm/opto/postaloc.cpp b/hotspot/src/share/vm/opto/postaloc.cpp
index f2605b0cb46..603264acc76 100644
--- a/hotspot/src/share/vm/opto/postaloc.cpp
+++ b/hotspot/src/share/vm/opto/postaloc.cpp
@@ -100,10 +100,13 @@ int PhaseChaitin::yank_if_dead( Node *old, Block *current_block, Node_List *valu
     Node *tmp = NULL;
     for (uint i = 1; i < old->req(); i++) {
       if (old->in(i)->is_MachTemp()) {
+        // handle TEMP inputs
         Node* machtmp = old->in(i);
-        assert(machtmp->outcnt() == 1, "expected for a MachTemp");
-        blk_adjust += yank(machtmp, current_block, value, regnd);
-        machtmp->disconnect_inputs(NULL);
+        if (machtmp->outcnt() == 1) {
+          assert(machtmp->unique_out() == old, "sanity");
+          blk_adjust += yank(machtmp, current_block, value, regnd);
+          machtmp->disconnect_inputs(NULL);
+        }
       } else {
         assert(tmp == NULL, "can't handle more non MachTemp inputs");
         tmp = old->in(i);