< prev index next >

src/hotspot/share/c1/c1_LinearScan.cpp

Print this page
*** 1238,15 ***
          }
        }
        break;
      }
      case lir_cmove: {
!       assert(op->as_Op2() != NULL, "lir_cmove must be LIR_Op2");
!       LIR_Op2* cmove = (LIR_Op2*)op;
  
        LIR_Opr move_from = cmove->in_opr1();
!       LIR_Opr move_to = cmove->result_opr();
  
        if (move_to->is_register() && move_from->is_register()) {
          Interval* from = interval_at(reg_num(move_from));
          Interval* to = interval_at(reg_num(move_to));
          if (from != NULL && to != NULL) {
--- 1238,15 ---
          }
        }
        break;
      }
      case lir_cmove: {
!       assert(op->as_Op4() != NULL, "lir_cmove must be LIR_Op4");
!       LIR_Op4* cmove = (LIR_Op4*)op;
  
        LIR_Opr move_from = cmove->in_opr1();
!       LIR_Opr move_to   = cmove->result_opr();
  
        if (move_to->is_register() && move_from->is_register()) {
          Interval* from = interval_at(reg_num(move_from));
          Interval* to = interval_at(reg_num(move_to));
          if (from != NULL && to != NULL) {

*** 3129,17 ***
--- 3129,21 ---
        allocate_fpu_stack(); // Only has effect on Intel
        NOT_PRODUCT(print_lir(2, "LIR after FPU stack allocation:"));
      }
    }
  
+ #ifndef RISCV
+   // Disable these optimizations on riscv temporarily, because it does not
+   // work when the comparison operands are bound to branches or cmoves.
    { TIME_LINEAR_SCAN(timer_optimize_lir);
  
      EdgeMoveOptimizer::optimize(ir()->code());
      ControlFlowOptimizer::optimize(ir()->code());
      // check that cfg is still correct after optimizations
      ir()->verify();
    }
+ #endif
  
    NOT_PRODUCT(print_lir(1, "Before Code Generation", false));
    NOT_PRODUCT(LinearScanStatistic::compute(this, _stat_final));
    NOT_PRODUCT(_total_timer.end_method(this));
  }

*** 6359,18 ***
  
                LIR_Op2* prev_cmp = NULL;
                // There might be a cmove inserted for profiling which depends on the same
                // compare. If we change the condition of the respective compare, we have
                // to take care of this cmove as well.
!               LIR_Op2* prev_cmove = NULL;
  
                for(int j = instructions->length() - 3; j >= 0 && prev_cmp == NULL; j--) {
                  prev_op = instructions->at(j);
                  // check for the cmove
                  if (prev_op->code() == lir_cmove) {
!                   assert(prev_op->as_Op2() != NULL, "cmove must be of type LIR_Op2");
!                   prev_cmove = (LIR_Op2*)prev_op;
                    assert(prev_branch->cond() == prev_cmove->condition(), "should be the same");
                  }
                  if (prev_op->code() == lir_cmp) {
                    assert(prev_op->as_Op2() != NULL, "branch must be of type LIR_Op2");
                    prev_cmp = (LIR_Op2*)prev_op;
--- 6363,18 ---
  
                LIR_Op2* prev_cmp = NULL;
                // There might be a cmove inserted for profiling which depends on the same
                // compare. If we change the condition of the respective compare, we have
                // to take care of this cmove as well.
!               LIR_Op4* prev_cmove = NULL;
  
                for(int j = instructions->length() - 3; j >= 0 && prev_cmp == NULL; j--) {
                  prev_op = instructions->at(j);
                  // check for the cmove
                  if (prev_op->code() == lir_cmove) {
!                   assert(prev_op->as_Op4() != NULL, "cmove must be of type LIR_Op4");
!                   prev_cmove = (LIR_Op4*)prev_op;
                    assert(prev_branch->cond() == prev_cmove->condition(), "should be the same");
                  }
                  if (prev_op->code() == lir_cmp) {
                    assert(prev_op->as_Op2() != NULL, "branch must be of type LIR_Op2");
                    prev_cmp = (LIR_Op2*)prev_op;
< prev index next >