7077439: Possible reference through NULL in loopPredicate.cpp:726

Use cl->is_valid_counted_loop() check.

Reviewed-by: never
This commit is contained in:
Vladimir Kozlov 2011-08-10 14:06:57 -07:00
parent b543a07b9a
commit 52f678435a
4 changed files with 9 additions and 7 deletions

View file

@ -689,6 +689,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) {
assert(loop->_head->is_CountedLoop(), "");
CountedLoopNode *cl = loop->_head->as_CountedLoop();
assert(cl->is_valid_counted_loop(), "");
if (!LoopLimitCheck || ABS(cl->stride_con()) == 1 ||
cl->limit()->Opcode() == Op_LoopLimit) {
@ -1608,14 +1609,13 @@ bool PhaseIdealLoop::is_deleteable_safept(Node* sfpt) {
void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) {
assert(loop->_head->is_CountedLoop(), "");
CountedLoopNode *cl = loop->_head->as_CountedLoop();
if (!cl->is_valid_counted_loop())
return; // skip malformed counted loop
Node *incr = cl->incr();
if (incr == NULL)
return; // Dead loop?
Node *init = cl->init_trip();
Node *phi = cl->phi();
// protect against stride not being a constant
if (!cl->stride_is_con())
return;
int stride_con = cl->stride_con();
PhaseGVN *gvn = &_igvn;