6676841: ClearArrayNode::Identity is incorrect for 64-bit
authornever
Tue, 18 Mar 2008 23:44:46 -0700
changeset 241 96ca4f142c22
parent 240 a9ec1f7d29d6
child 242 f4a8c30a53b0
6676841: ClearArrayNode::Identity is incorrect for 64-bit Summary: ClearArrayNode::Identity should use TypeX instead of TypeInt Reviewed-by: jrose, kvn, sgoldman
hotspot/src/share/vm/opto/memnode.cpp
--- a/hotspot/src/share/vm/opto/memnode.cpp	Tue Mar 18 11:17:37 2008 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Tue Mar 18 23:44:46 2008 -0700
@@ -1881,7 +1881,7 @@
 //------------------------------Identity---------------------------------------
 // Clearing a zero length array does nothing
 Node *ClearArrayNode::Identity( PhaseTransform *phase ) {
-  return phase->type(in(2))->higher_equal(TypeInt::ZERO)  ? in(1) : this;
+  return phase->type(in(2))->higher_equal(TypeX::ZERO)  ? in(1) : this;
 }
 
 //------------------------------Idealize---------------------------------------
@@ -1954,6 +1954,11 @@
                                    Node* start_offset,
                                    Node* end_offset,
                                    PhaseGVN* phase) {
+  if (start_offset == end_offset) {
+    // nothing to do
+    return mem;
+  }
+
   Compile* C = phase->C;
   int unit = BytesPerLong;
   Node* zbase = start_offset;
@@ -1979,6 +1984,11 @@
                                    intptr_t start_offset,
                                    intptr_t end_offset,
                                    PhaseGVN* phase) {
+  if (start_offset == end_offset) {
+    // nothing to do
+    return mem;
+  }
+
   Compile* C = phase->C;
   assert((end_offset % BytesPerInt) == 0, "odd end offset");
   intptr_t done_offset = end_offset;