comparison src/share/vm/opto/loopTransform.cpp @ 3782:aacaff365100

7052494: Eclipse test fails on JDK 7 b142 Summary: Keep 'ne' test in Counted loop when we can't guarantee during compilation that init < limit. Reviewed-by: never
author kvn
date Mon, 20 Jun 2011 16:45:35 -0700
parents 789d04408ca3
children e3cbc9ddd434
comparison
equal deleted inserted replaced
3781:d83ac25d0304 3782:aacaff365100
81 return; // Infinite loop 81 return; // Infinite loop
82 82
83 #ifdef ASSERT 83 #ifdef ASSERT
84 BoolTest::mask bt = cl->loopexit()->test_trip(); 84 BoolTest::mask bt = cl->loopexit()->test_trip();
85 assert(bt == BoolTest::lt || bt == BoolTest::gt || 85 assert(bt == BoolTest::lt || bt == BoolTest::gt ||
86 (bt == BoolTest::ne && !LoopLimitCheck), "canonical test is expected"); 86 bt == BoolTest::ne, "canonical test is expected");
87 #endif 87 #endif
88 88
89 Node* init_n = cl->init_trip(); 89 Node* init_n = cl->init_trip();
90 Node* limit_n = cl->limit(); 90 Node* limit_n = cl->limit();
91 if (init_n != NULL && init_n->is_Con() && 91 if (init_n != NULL && init_n->is_Con() &&
1068 // Change pre loop test, main loop test, and the 1068 // Change pre loop test, main loop test, and the
1069 // main loop guard test to use lt or gt depending on stride 1069 // main loop guard test to use lt or gt depending on stride
1070 // direction: 1070 // direction:
1071 // positive stride use < 1071 // positive stride use <
1072 // negative stride use > 1072 // negative stride use >
1073 //
1074 // not-equal test is kept for post loop to handle case
1075 // when init > limit when stride > 0 (and reverse).
1073 1076
1074 if (pre_end->in(CountedLoopEndNode::TestValue)->as_Bool()->_test._test == BoolTest::ne) { 1077 if (pre_end->in(CountedLoopEndNode::TestValue)->as_Bool()->_test._test == BoolTest::ne) {
1075 assert(!LoopLimitCheck, "only canonical tests (lt or gt) are expected");
1076 1078
1077 BoolTest::mask new_test = (main_end->stride_con() > 0) ? BoolTest::lt : BoolTest::gt; 1079 BoolTest::mask new_test = (main_end->stride_con() > 0) ? BoolTest::lt : BoolTest::gt;
1078 // Modify pre loop end condition 1080 // Modify pre loop end condition
1079 Node* pre_bol = pre_end->in(CountedLoopEndNode::TestValue)->as_Bool(); 1081 Node* pre_bol = pre_end->in(CountedLoopEndNode::TestValue)->as_Bool();
1080 BoolNode* new_bol0 = new (C, 2) BoolNode(pre_bol->in(1), new_test); 1082 BoolNode* new_bol0 = new (C, 2) BoolNode(pre_bol->in(1), new_test);