@@ -318,7 +318,6 @@ class LoopInvariantCodeMotion : public StackObj {
318318 ValueStack * _state;
319319 bool _insert_is_pred;
320320
321- void set_invariant (Value v) const { _gvn->set_processed (v); }
322321 bool is_invariant (Value v) const { return _gvn->is_processed (v); }
323322
324323 void process_block (BlockBegin* block);
@@ -367,7 +366,6 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
367366 Instruction* cur = block->next ();
368367
369368 while (cur != NULL ) {
370-
371369 // determine if cur instruction is loop invariant
372370 // only selected instruction types are processed here
373371 bool cur_invariant = false ;
@@ -388,6 +386,12 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
388386 } else if (cur->as_LoadIndexed () != NULL ) {
389387 LoadIndexed *li = (LoadIndexed *)cur->as_LoadIndexed ();
390388 cur_invariant = !_short_loop_optimizer->has_indexed_store (as_BasicType (cur->type ())) && is_invariant (li->array ()) && is_invariant (li->index ()) && _insert_is_pred;
389+ } else if (cur->as_NegateOp () != NULL ) {
390+ NegateOp* neg = (NegateOp*)cur->as_NegateOp ();
391+ cur_invariant = is_invariant (neg->x ());
392+ } else if (cur->as_Convert () != NULL ) {
393+ Convert* cvt = (Convert*)cur->as_Convert ();
394+ cur_invariant = is_invariant (cvt->value ());
391395 }
392396
393397 if (cur_invariant) {
@@ -412,6 +416,7 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
412416 cur->set_exception_handlers (NULL );
413417
414418 TRACE_VALUE_NUMBERING (tty->print_cr (" Instruction %c%d is loop invariant" , cur->type ()->tchar (), cur->id ()));
419+ TRACE_VALUE_NUMBERING (cur->print_line ());
415420
416421 if (cur->state_before () != NULL ) {
417422 cur->set_state_before (_state->copy ());
@@ -421,7 +426,6 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
421426 }
422427
423428 cur = prev->set_next (next);
424-
425429 } else {
426430 prev = cur;
427431 cur = cur->next ();
@@ -585,7 +589,7 @@ void GlobalValueNumbering::substitute(Instruction* instr) {
585589 if (subst != instr) {
586590 assert (!subst->has_subst (), " can't have a substitution" );
587591
588- TRACE_VALUE_NUMBERING (tty->print_cr (" substitution for %d set to %d" , instr->id (), subst->id ()));
592+ TRACE_VALUE_NUMBERING (tty->print_cr (" substitution for %c% d set to %c% d" , instr->type ()-> tchar (), instr-> id (), subst-> type ()-> tchar (), subst->id ()));
589593 instr->set_subst (subst);
590594 _has_substitutions = true ;
591595 }
0 commit comments