140 Node *x2 = phase->makecon( add1->as_Add()->add_ring( t2, t12 ));
141 PhaseIterGVN *igvn = phase->is_IterGVN();
142 if( igvn ) {
143 set_req_X(2,x2,igvn);
144 set_req_X(1,x1,igvn);
145 } else {
146 set_req(2,x2);
147 set_req(1,x1);
148 }
149 progress = this; // Made progress
150 add1 = in(1);
151 add1_op = add1->Opcode();
152 }
153 }
154
155 // Convert "(x+1)+y" into "(x+y)+1". Push constants down the expression tree.
156 if( add1_op == this_op && !con_right ) {
157 Node *a12 = add1->in(2);
158 const Type *t12 = phase->type( a12 );
159 if( t12->singleton() && t12 != Type::TOP && (add1 != add1->in(1)) ) {
160 add2 = add1->clone();
161 add2->set_req(2, in(2));
162 add2 = phase->transform(add2);
163 set_req(1, add2);
164 set_req(2, a12);
165 progress = this;
166 add2 = a12;
167 }
168 }
169
170 // Convert "x+(y+1)" into "(x+y)+1". Push constants down the expression tree.
171 int add2_op = add2->Opcode();
172 if( add2_op == this_op && !con_left ) {
173 Node *a22 = add2->in(2);
174 const Type *t22 = phase->type( a22 );
175 if( t22->singleton() && t22 != Type::TOP && (add2 != add2->in(1)) ) {
176 Node *addx = add2->clone();
177 addx->set_req(1, in(1));
178 addx->set_req(2, add2->in(1));
179 addx = phase->transform(addx);
180 set_req(1, addx);
181 set_req(2, a22);
182 progress = this;
183 }
184 }
185
186 return progress;
187 }
188
189 //------------------------------Value-----------------------------------------
190 // An add node sums it's two _in. If one input is an RSD, we must mixin
191 // the other input's symbols.
192 const Type *AddNode::Value( PhaseTransform *phase ) const {
193 // Either input is TOP ==> the result is TOP
194 const Type *t1 = phase->type( in(1) );
195 const Type *t2 = phase->type( in(2) );
|
140 Node *x2 = phase->makecon( add1->as_Add()->add_ring( t2, t12 ));
141 PhaseIterGVN *igvn = phase->is_IterGVN();
142 if( igvn ) {
143 set_req_X(2,x2,igvn);
144 set_req_X(1,x1,igvn);
145 } else {
146 set_req(2,x2);
147 set_req(1,x1);
148 }
149 progress = this; // Made progress
150 add1 = in(1);
151 add1_op = add1->Opcode();
152 }
153 }
154
155 // Convert "(x+1)+y" into "(x+y)+1". Push constants down the expression tree.
156 if( add1_op == this_op && !con_right ) {
157 Node *a12 = add1->in(2);
158 const Type *t12 = phase->type( a12 );
159 if( t12->singleton() && t12 != Type::TOP && (add1 != add1->in(1)) ) {
160 if (add1->in(1) == this)
161 return phase->C->top(); // Dead loop
162 add2 = add1->clone();
163 add2->set_req(2, in(2));
164 add2 = phase->transform(add2);
165 set_req(1, add2);
166 set_req(2, a12);
167 progress = this;
168 add2 = a12;
169 }
170 }
171
172 // Convert "x+(y+1)" into "(x+y)+1". Push constants down the expression tree.
173 int add2_op = add2->Opcode();
174 if( add2_op == this_op && !con_left ) {
175 Node *a22 = add2->in(2);
176 const Type *t22 = phase->type( a22 );
177 if( t22->singleton() && t22 != Type::TOP && (add2 != add2->in(1)) ) {
178 if (add2->in(1) == this)
179 return phase->C->top(); // Dead loop
180 Node *addx = add2->clone();
181 addx->set_req(1, in(1));
182 addx->set_req(2, add2->in(1));
183 addx = phase->transform(addx);
184 set_req(1, addx);
185 set_req(2, a22);
186 progress = this;
187 }
188 }
189
190 return progress;
191 }
192
193 //------------------------------Value-----------------------------------------
194 // An add node sums it's two _in. If one input is an RSD, we must mixin
195 // the other input's symbols.
196 const Type *AddNode::Value( PhaseTransform *phase ) const {
197 // Either input is TOP ==> the result is TOP
198 const Type *t1 = phase->type( in(1) );
199 const Type *t2 = phase->type( in(2) );
|