Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/loopnode.cpp @ 3850:6987871cfb9b
7077439: Possible reference through NULL in loopPredicate.cpp:726
Summary: Use cl->is_valid_counted_loop() check.
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 10 Aug 2011 14:06:57 -0700 |
parents | c96c3eb1efae |
children | 2c24ef16533d |
comparison
equal
deleted
inserted
replaced
3849:f1c12354c3f7 | 3850:6987871cfb9b |
---|---|
687 | 687 |
688 //----------------------exact_limit------------------------------------------- | 688 //----------------------exact_limit------------------------------------------- |
689 Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) { | 689 Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) { |
690 assert(loop->_head->is_CountedLoop(), ""); | 690 assert(loop->_head->is_CountedLoop(), ""); |
691 CountedLoopNode *cl = loop->_head->as_CountedLoop(); | 691 CountedLoopNode *cl = loop->_head->as_CountedLoop(); |
692 assert(cl->is_valid_counted_loop(), ""); | |
692 | 693 |
693 if (!LoopLimitCheck || ABS(cl->stride_con()) == 1 || | 694 if (!LoopLimitCheck || ABS(cl->stride_con()) == 1 || |
694 cl->limit()->Opcode() == Op_LoopLimit) { | 695 cl->limit()->Opcode() == Op_LoopLimit) { |
695 // Old code has exact limit (it could be incorrect in case of int overflow). | 696 // Old code has exact limit (it could be incorrect in case of int overflow). |
696 // Loop limit is exact with stride == 1. And loop may already have exact limit. | 697 // Loop limit is exact with stride == 1. And loop may already have exact limit. |
1606 //---------------------------replace_parallel_iv------------------------------- | 1607 //---------------------------replace_parallel_iv------------------------------- |
1607 // Replace parallel induction variable (parallel to trip counter) | 1608 // Replace parallel induction variable (parallel to trip counter) |
1608 void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) { | 1609 void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) { |
1609 assert(loop->_head->is_CountedLoop(), ""); | 1610 assert(loop->_head->is_CountedLoop(), ""); |
1610 CountedLoopNode *cl = loop->_head->as_CountedLoop(); | 1611 CountedLoopNode *cl = loop->_head->as_CountedLoop(); |
1612 if (!cl->is_valid_counted_loop()) | |
1613 return; // skip malformed counted loop | |
1611 Node *incr = cl->incr(); | 1614 Node *incr = cl->incr(); |
1612 if (incr == NULL) | 1615 if (incr == NULL) |
1613 return; // Dead loop? | 1616 return; // Dead loop? |
1614 Node *init = cl->init_trip(); | 1617 Node *init = cl->init_trip(); |
1615 Node *phi = cl->phi(); | 1618 Node *phi = cl->phi(); |
1616 // protect against stride not being a constant | |
1617 if (!cl->stride_is_con()) | |
1618 return; | |
1619 int stride_con = cl->stride_con(); | 1619 int stride_con = cl->stride_con(); |
1620 | 1620 |
1621 PhaseGVN *gvn = &_igvn; | 1621 PhaseGVN *gvn = &_igvn; |
1622 | 1622 |
1623 // Visit all children, looking for Phis | 1623 // Visit all children, looking for Phis |