The places where constant_expression_value are still used in loop
analysis are places where a new expression tree is created and
constant folding won't have happened. This is used, for example, when
we try to determine the maximal loop iteration count.
Based on review comments by Eric. "...rely on constant folding to
have done its job, instead of going all through the subtree again when
it wasn't a constant."
ir_rvalue *inc = (op0 == var) ? rhs->operands[1] : rhs->operands[0];
- if (inc->constant_expression_value() == NULL) {
+ if (inc->as_constant() == NULL) {
ir_variable *const inc_var = inc->variable_referenced();
if (inc_var != NULL) {
loop_variable *lv =
* which.
*/
ir_rvalue *counter = cond->operands[0]->as_dereference_variable();
- ir_constant *limit = cond->operands[1]->constant_expression_value();
+ ir_constant *limit = cond->operands[1]->as_constant();
enum ir_expression_operation cmp = cond->operation;
if (limit == NULL) {
counter = cond->operands[1]->as_dereference_variable();
- limit = cond->operands[0]->constant_expression_value();
+ limit = cond->operands[0]->as_constant();
switch (cmp) {
case ir_binop_less: cmp = ir_binop_gequal; break;