comparison src/share/vm/opto/loopTransform.cpp @ 3333:ae93231c7a1f

7039652: Performance regression after 7004547 changes Summary: Use unrolled_count() to limit unrolling and use the stride check only for initial stride value. Reviewed-by: never
author kvn
date Thu, 28 Apr 2011 16:40:23 -0700
parents 6c97c830fb6f
children bad7ecd0b6ed
comparison
equal deleted inserted replaced
3283:01fd6090fdd8 3333:ae93231c7a1f
630 630
631 return true; // Do maximally unroll 631 return true; // Do maximally unroll
632 } 632 }
633 633
634 634
635 #define MAX_UNROLL 16 // maximum number of unrolls for main loop
636
635 //------------------------------policy_unroll---------------------------------- 637 //------------------------------policy_unroll----------------------------------
636 // Return TRUE or FALSE if the loop should be unrolled or not. Unroll if 638 // Return TRUE or FALSE if the loop should be unrolled or not. Unroll if
637 // the loop is a CountedLoop and the body is small enough. 639 // the loop is a CountedLoop and the body is small enough.
638 bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const { 640 bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const {
639 641
644 return false; // Malformed counted loop 646 return false; // Malformed counted loop
645 647
646 // protect against over-unrolling 648 // protect against over-unrolling
647 if (cl->trip_count() <= 1) return false; 649 if (cl->trip_count() <= 1) return false;
648 650
649 // Check for stride being a small enough constant
650 if (abs(cl->stride_con()) > (1<<3)) return false;
651
652 int future_unroll_ct = cl->unrolled_count() * 2; 651 int future_unroll_ct = cl->unrolled_count() * 2;
652 if (future_unroll_ct > MAX_UNROLL) return false;
653
654 // Check for initial stride being a small enough constant
655 if (abs(cl->stride_con()) > (1<<2)*future_unroll_ct) return false;
653 656
654 // Don't unroll if the next round of unrolling would push us 657 // Don't unroll if the next round of unrolling would push us
655 // over the expected trip count of the loop. One is subtracted 658 // over the expected trip count of the loop. One is subtracted
656 // from the expected trip count because the pre-loop normally 659 // from the expected trip count because the pre-loop normally
657 // executes 1 iteration. 660 // executes 1 iteration.