--- a/hotspot/src/share/vm/opto/loopnode.hpp Mon Feb 11 14:47:04 2013 -0800
+++ b/hotspot/src/share/vm/opto/loopnode.hpp Tue Feb 12 12:56:11 2013 +0100
@@ -263,9 +263,18 @@
bool stride_is_con() const { Node *tmp = stride (); return (tmp != NULL && tmp->is_Con()); }
BoolTest::mask test_trip() const { return in(TestValue)->as_Bool()->_test._test; }
CountedLoopNode *loopnode() const {
+ // The CountedLoopNode that goes with this CountedLoopEndNode may
+ // have been optimized out by the IGVN so be cautious with the
+ // pattern matching on the graph
+ if (phi() == NULL) {
+ return NULL;
+ }
Node *ln = phi()->in(0);
- assert( ln->Opcode() == Op_CountedLoop, "malformed loop" );
- return (CountedLoopNode*)ln; }
+ if (ln->is_CountedLoop() && ln->as_CountedLoop()->loopexit() == this) {
+ return (CountedLoopNode*)ln;
+ }
+ return NULL;
+ }
#ifndef PRODUCT
virtual void dump_spec(outputStream *st) const;
@@ -598,6 +607,7 @@
// check if transform created new nodes that need _ctrl recorded
Node *get_late_ctrl( Node *n, Node *early );
Node *get_early_ctrl( Node *n );
+ Node *get_early_ctrl_for_expensive(Node *n, Node* earliest);
void set_early_ctrl( Node *n );
void set_subtree_ctrl( Node *root );
void set_ctrl( Node *n, Node *ctrl ) {
@@ -905,6 +915,16 @@
void collect_potentially_useful_predicates(IdealLoopTree *loop, Unique_Node_List &predicate_opaque1);
void eliminate_useless_predicates();
+ // Change the control input of expensive nodes to allow commoning by
+ // IGVN when it is guaranteed to not result in a more frequent
+ // execution of the expensive node. Return true if progress.
+ bool process_expensive_nodes();
+
+ // Check whether node has become unreachable
+ bool is_node_unreachable(Node *n) const {
+ return !has_node(n) || n->is_unreachable(_igvn);
+ }
+
// Eliminate range-checks and other trip-counter vs loop-invariant tests.
void do_range_check( IdealLoopTree *loop, Node_List &old_new );
@@ -1043,7 +1063,7 @@
void register_new_node( Node *n, Node *blk );
#ifdef ASSERT
-void dump_bad_graph(Node* n, Node* early, Node* LCA);
+ void dump_bad_graph(const char* msg, Node* n, Node* early, Node* LCA);
#endif
#ifndef PRODUCT