Initial Fix

This commit is contained in:
Saranya Natarajan 2025-06-11 15:43:19 +02:00
parent 3ff83ec49e
commit 767326bfc7
3 changed files with 19 additions and 0 deletions

View File

@ -1399,6 +1399,7 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n
CountedLoopNode *post_head = nullptr; CountedLoopNode *post_head = nullptr;
Node* post_incr = incr; Node* post_incr = incr;
Node* main_exit = insert_post_loop(loop, old_new, main_head, main_end, post_incr, limit, post_head); Node* main_exit = insert_post_loop(loop, old_new, main_head, main_end, post_incr, limit, post_head);
C->print_method(PHASE_AFTER_POST_LOOP, 4, main_head);
//------------------------------ //------------------------------
// Step B: Create Pre-Loop. // Step B: Create Pre-Loop.
@ -1613,8 +1614,10 @@ void PhaseIdealLoop::insert_vector_post_loop(IdealLoopTree *loop, Node_List &old
Node *limit = main_end->limit(); Node *limit = main_end->limit();
// In this case we throw away the result as we are not using it to connect anything else. // In this case we throw away the result as we are not using it to connect anything else.
C->print_method(PHASE_BEFORE_POST_LOOP, 4, main_head);
CountedLoopNode *post_head = nullptr; CountedLoopNode *post_head = nullptr;
insert_post_loop(loop, old_new, main_head, main_end, incr, limit, post_head); insert_post_loop(loop, old_new, main_head, main_end, incr, limit, post_head);
C->print_method(PHASE_AFTER_POST_LOOP, 4, main_head);
// It's difficult to be precise about the trip-counts // It's difficult to be precise about the trip-counts
// for post loops. They are usually very short, // for post loops. They are usually very short,
@ -3077,6 +3080,7 @@ bool IdealLoopTree::do_remove_empty_loop(PhaseIdealLoop *phase) {
return false; return false;
} }
} }
phase->C->print_method(PHASE_BEFORE_REMOVE_EMPTY_LOOP, 4, cl);
if (cl->is_pre_loop()) { if (cl->is_pre_loop()) {
// If the loop we are removing is a pre-loop then the main and post loop // If the loop we are removing is a pre-loop then the main and post loop
// can be removed as well. // can be removed as well.
@ -3179,6 +3183,7 @@ bool IdealLoopTree::do_remove_empty_loop(PhaseIdealLoop *phase) {
phase->_igvn.replace_input_of(cl->loopexit(), CountedLoopEndNode::TestValue, zero); phase->_igvn.replace_input_of(cl->loopexit(), CountedLoopEndNode::TestValue, zero);
phase->C->set_major_progress(); phase->C->set_major_progress();
phase->C->print_method(PHASE_AFTER_REMOVE_EMPTY_LOOP, 4, cl);
return true; return true;
} }
@ -3331,6 +3336,7 @@ bool IdealLoopTree::do_one_iteration_loop(PhaseIdealLoop *phase) {
} }
#endif #endif
phase->C->print_method(PHASE_BEFORE_ONE_ITERATION_LOOP, 4, cl);
Node *init_n = cl->init_trip(); Node *init_n = cl->init_trip();
// Loop boundaries should be constant since trip count is exact. // Loop boundaries should be constant since trip count is exact.
assert((cl->stride_con() > 0 && init_n->get_int() + cl->stride_con() >= cl->limit()->get_int()) || assert((cl->stride_con() > 0 && init_n->get_int() + cl->stride_con() >= cl->limit()->get_int()) ||
@ -3340,6 +3346,7 @@ bool IdealLoopTree::do_one_iteration_loop(PhaseIdealLoop *phase) {
// and all loop-invariant uses of the exit values will be correct. // and all loop-invariant uses of the exit values will be correct.
phase->_igvn.replace_node(cl->phi(), cl->init_trip()); phase->_igvn.replace_node(cl->phi(), cl->init_trip());
phase->C->set_major_progress(); phase->C->set_major_progress();
phase->C->print_method(PHASE_AFTER_ONE_INTERATION_LOOP, 4, cl);
return true; return true;
} }

View File

@ -71,6 +71,12 @@
flags(AFTER_RANGE_CHECK_ELIMINATION, "After Range Check Elimination") \ flags(AFTER_RANGE_CHECK_ELIMINATION, "After Range Check Elimination") \
flags(BEFORE_PRE_MAIN_POST, "Before Pre/Main/Post Loops") \ flags(BEFORE_PRE_MAIN_POST, "Before Pre/Main/Post Loops") \
flags(AFTER_PRE_MAIN_POST, "After Pre/Main/Post Loops") \ flags(AFTER_PRE_MAIN_POST, "After Pre/Main/Post Loops") \
flags(BEFORE_POST_LOOP, "Before Post Loops") \
flags(AFTER_POST_LOOP, "After Post Loops") \
flags(BEFORE_REMOVE_EMPTY_LOOP, "Before Remove Empty Loops") \
flags(AFTER_REMOVE_EMPTY_LOOP, "After Remove Empty Loops") \
flags(BEFORE_ONE_ITERATION_LOOP, "Before Replacing One Iteration Loops") \
flags(AFTER_ONE_INTERATION_LOOP, "After Replacing One Iteration Loops") \
flags(AUTO_VECTORIZATION1_BEFORE_APPLY, "AutoVectorization 1, Before Apply") \ flags(AUTO_VECTORIZATION1_BEFORE_APPLY, "AutoVectorization 1, Before Apply") \
flags(AUTO_VECTORIZATION2_AFTER_REORDER, "AutoVectorization 2, After Apply Memop Reordering") \ flags(AUTO_VECTORIZATION2_AFTER_REORDER, "AutoVectorization 2, After Apply Memop Reordering") \
flags(AUTO_VECTORIZATION3_AFTER_ADJUST_LIMIT, "AutoVectorization 3, After Adjusting Pre-Loop Limit") \ flags(AUTO_VECTORIZATION3_AFTER_ADJUST_LIMIT, "AutoVectorization 3, After Adjusting Pre-Loop Limit") \

View File

@ -79,6 +79,12 @@ public enum CompilePhase {
AFTER_RANGE_CHECK_ELIMINATION("After Range Check Elimination"), AFTER_RANGE_CHECK_ELIMINATION("After Range Check Elimination"),
BEFORE_PRE_MAIN_POST("Before Pre/Main/Post Loops"), BEFORE_PRE_MAIN_POST("Before Pre/Main/Post Loops"),
AFTER_PRE_MAIN_POST("After Pre/Main/Post Loops"), AFTER_PRE_MAIN_POST("After Pre/Main/Post Loops"),
BEFORE_POST_LOOP("Before Post Loops"),
AFTER_POST_LOOP("After Post Loop"),
BEFORE_REMOVE_EMPTY_LOOP("Before Remove Empty Loops"),
AFTER_REMOVE_EMPTY_LOOP("After Remove Empty Loops"),
BEFORE_ONE_ITERATION_LOOP("Before Replacing One Iteration Loops"),
AFTER_ONE_INTERATION_LOOP("After Replacing One Iteration Loops"),
SUPERWORD1_BEFORE_SCHEDULE("Superword 1, Before Schedule"), SUPERWORD1_BEFORE_SCHEDULE("Superword 1, Before Schedule"),
SUPERWORD2_BEFORE_OUTPUT("Superword 2, Before Output"), SUPERWORD2_BEFORE_OUTPUT("Superword 2, Before Output"),
SUPERWORD3_AFTER_OUTPUT("Superword 3, After Output"), SUPERWORD3_AFTER_OUTPUT("Superword 3, After Output"),