hotspot/src/share/vm/opto/addnode.cpp
changeset 1124 4de0b4f7eae3
parent 1068 720698d9c89b
child 1432 44f076e3d2a4
equal deleted inserted replaced
1123:3fdc7f23127c 1124:4de0b4f7eae3
   155   // Convert "(x+1)+y" into "(x+y)+1".  Push constants down the expression tree.
   155   // Convert "(x+1)+y" into "(x+y)+1".  Push constants down the expression tree.
   156   if( add1_op == this_op && !con_right ) {
   156   if( add1_op == this_op && !con_right ) {
   157     Node *a12 = add1->in(2);
   157     Node *a12 = add1->in(2);
   158     const Type *t12 = phase->type( a12 );
   158     const Type *t12 = phase->type( a12 );
   159     if( t12->singleton() && t12 != Type::TOP && (add1 != add1->in(1)) ) {
   159     if( t12->singleton() && t12 != Type::TOP && (add1 != add1->in(1)) ) {
       
   160       assert(add1->in(1) != this, "dead loop in AddNode::Ideal");
   160       add2 = add1->clone();
   161       add2 = add1->clone();
   161       add2->set_req(2, in(2));
   162       add2->set_req(2, in(2));
   162       add2 = phase->transform(add2);
   163       add2 = phase->transform(add2);
   163       set_req(1, add2);
   164       set_req(1, add2);
   164       set_req(2, a12);
   165       set_req(2, a12);
   171   int add2_op = add2->Opcode();
   172   int add2_op = add2->Opcode();
   172   if( add2_op == this_op && !con_left ) {
   173   if( add2_op == this_op && !con_left ) {
   173     Node *a22 = add2->in(2);
   174     Node *a22 = add2->in(2);
   174     const Type *t22 = phase->type( a22 );
   175     const Type *t22 = phase->type( a22 );
   175     if( t22->singleton() && t22 != Type::TOP && (add2 != add2->in(1)) ) {
   176     if( t22->singleton() && t22 != Type::TOP && (add2 != add2->in(1)) ) {
       
   177       assert(add2->in(1) != this, "dead loop in AddNode::Ideal");
   176       Node *addx = add2->clone();
   178       Node *addx = add2->clone();
   177       addx->set_req(1, in(1));
   179       addx->set_req(1, in(1));
   178       addx->set_req(2, add2->in(1));
   180       addx->set_req(2, add2->in(1));
   179       addx = phase->transform(addx);
   181       addx = phase->transform(addx);
   180       set_req(1, addx);
   182       set_req(1, addx);