diff --git a/src/share/vm/opto/loopopts.cpp b/src/share/vm/opto/loopopts.cpp index 062daec663fb9c07f5c959419fafc1949014e37b..e19f35a0a11f6ead8a8c135caacf8ecc7d10b238 100644 --- a/src/share/vm/opto/loopopts.cpp +++ b/src/share/vm/opto/loopopts.cpp @@ -43,6 +43,14 @@ Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *region, int policy ) { return NULL; } + // Splitting range check CastIIs through a loop induction Phi can + // cause new Phis to be created that are left unrelated to the loop + // induction Phi and prevent optimizations (vectorization) + if (n->Opcode() == Op_CastII && n->as_CastII()->has_range_check() && + region->is_CountedLoop() && n->in(1) == region->as_CountedLoop()->phi()) { + return NULL; + } + int wins = 0; assert(!n->is_CFG(), ""); assert(region->is_Region(), "");