src/share/vm/opto/ifnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/ifnode.cpp

Print this page
rev 5902 : 8027754: Enable loop optimizations for loops with MathExact inside


  59 }
  60 
  61 const RegMask &IfNode::out_RegMask() const {
  62   return RegMask::Empty;
  63 }
  64 
  65 //------------------------------split_if---------------------------------------
  66 // Look for places where we merge constants, then test on the merged value.
  67 // If the IF test will be constant folded on the path with the constant, we
  68 // win by splitting the IF to before the merge point.
  69 static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
  70   // I could be a lot more general here, but I'm trying to squeeze this
  71   // in before the Christmas '98 break so I'm gonna be kinda restrictive
  72   // on the patterns I accept.  CNC
  73 
  74   // Look for a compare of a constant and a merged value
  75   Node *i1 = iff->in(1);
  76   if( !i1->is_Bool() ) return NULL;
  77   BoolNode *b = i1->as_Bool();
  78   Node *cmp = b->in(1);
  79   if( cmp->is_FlagsProj() ) return NULL;
  80   if( !cmp->is_Cmp() ) return NULL;
  81   i1 = cmp->in(1);
  82   if( i1 == NULL || !i1->is_Phi() ) return NULL;
  83   PhiNode *phi = i1->as_Phi();
  84   if( phi->is_copy() ) return NULL;
  85   Node *con2 = cmp->in(2);
  86   if( !con2->is_Con() ) return NULL;
  87   // See that the merge point contains some constants
  88   Node *con1=NULL;
  89   uint i4;
  90   for( i4 = 1; i4 < phi->req(); i4++ ) {
  91     con1 = phi->in(i4);
  92     if( !con1 ) return NULL;    // Do not optimize partially collapsed merges
  93     if( con1->is_Con() ) break; // Found a constant
  94     // Also allow null-vs-not-null checks
  95     const TypePtr *tp = igvn->type(con1)->isa_ptr();
  96     if( tp && tp->_ptr == TypePtr::NotNull )
  97       break;
  98   }
  99   if( i4 >= phi->req() ) return NULL; // Found no constants




  59 }
  60 
  61 const RegMask &IfNode::out_RegMask() const {
  62   return RegMask::Empty;
  63 }
  64 
  65 //------------------------------split_if---------------------------------------
  66 // Look for places where we merge constants, then test on the merged value.
  67 // If the IF test will be constant folded on the path with the constant, we
  68 // win by splitting the IF to before the merge point.
  69 static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
  70   // I could be a lot more general here, but I'm trying to squeeze this
  71   // in before the Christmas '98 break so I'm gonna be kinda restrictive
  72   // on the patterns I accept.  CNC
  73 
  74   // Look for a compare of a constant and a merged value
  75   Node *i1 = iff->in(1);
  76   if( !i1->is_Bool() ) return NULL;
  77   BoolNode *b = i1->as_Bool();
  78   Node *cmp = b->in(1);

  79   if( !cmp->is_Cmp() ) return NULL;
  80   i1 = cmp->in(1);
  81   if( i1 == NULL || !i1->is_Phi() ) return NULL;
  82   PhiNode *phi = i1->as_Phi();
  83   if( phi->is_copy() ) return NULL;
  84   Node *con2 = cmp->in(2);
  85   if( !con2->is_Con() ) return NULL;
  86   // See that the merge point contains some constants
  87   Node *con1=NULL;
  88   uint i4;
  89   for( i4 = 1; i4 < phi->req(); i4++ ) {
  90     con1 = phi->in(i4);
  91     if( !con1 ) return NULL;    // Do not optimize partially collapsed merges
  92     if( con1->is_Con() ) break; // Found a constant
  93     // Also allow null-vs-not-null checks
  94     const TypePtr *tp = igvn->type(con1)->isa_ptr();
  95     if( tp && tp->_ptr == TypePtr::NotNull )
  96       break;
  97   }
  98   if( i4 >= phi->req() ) return NULL; // Found no constants


src/share/vm/opto/ifnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File