From 7e4585a5e6e2776cce34932d8b8c8a7ed3a5691e Mon Sep 17 00:00:00 2001 From: kvn Date: Thu, 31 Mar 2011 13:22:34 -0700 Subject: [PATCH] 7032696: Fix for 7029152 broke VM Summary: StrIntrinsicNode::Ideal() should not optimize memory during Parse. Reviewed-by: jrose, never --- src/share/vm/opto/loopTransform.cpp | 6 ++++++ src/share/vm/opto/memnode.cpp | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/share/vm/opto/loopTransform.cpp b/src/share/vm/opto/loopTransform.cpp index e386dcd59..4c49ee0e6 100644 --- a/src/share/vm/opto/loopTransform.cpp +++ b/src/share/vm/opto/loopTransform.cpp @@ -432,6 +432,12 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const { return false; } + // Currently we don't have policy to optimize one iteration loops. + // Maximally unrolling transformation is used for that: + // it is peeled and the original loop become non reachable (dead). + if (trip_count == 1) + return true; + // Do not unroll a loop with String intrinsics code. // String intrinsics are large and have loops. for (uint k = 0; k < _body.size(); k++) { diff --git a/src/share/vm/opto/memnode.cpp b/src/share/vm/opto/memnode.cpp index 4c6878d3f..d5d53132a 100644 --- a/src/share/vm/opto/memnode.cpp +++ b/src/share/vm/opto/memnode.cpp @@ -2628,12 +2628,16 @@ uint StrIntrinsicNode::match_edge(uint idx) const { Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) { if (remove_dead_region(phase, can_reshape)) return this; - Node* mem = phase->transform(in(MemNode::Memory)); - // If transformed to a MergeMem, get the desired slice - uint alias_idx = phase->C->get_alias_index(adr_type()); - mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem; - if (mem != in(MemNode::Memory)) - set_req(MemNode::Memory, mem); + if (can_reshape) { + Node* mem = phase->transform(in(MemNode::Memory)); + // If transformed to a MergeMem, get the desired slice + uint alias_idx = phase->C->get_alias_index(adr_type()); + mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem; + if (mem != in(MemNode::Memory)) { + set_req(MemNode::Memory, mem); + return this; + } + } return NULL; } -- GitLab