@@ -318,7 +318,6 @@ class LoopInvariantCodeMotion : public StackObj {
318
318
ValueStack * _state;
319
319
bool _insert_is_pred;
320
320
321
- void set_invariant (Value v) const { _gvn->set_processed (v); }
322
321
bool is_invariant (Value v) const { return _gvn->is_processed (v); }
323
322
324
323
void process_block (BlockBegin* block);
@@ -367,7 +366,6 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
367
366
Instruction* cur = block->next ();
368
367
369
368
while (cur != NULL ) {
370
-
371
369
// determine if cur instruction is loop invariant
372
370
// only selected instruction types are processed here
373
371
bool cur_invariant = false ;
@@ -388,6 +386,12 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
388
386
} else if (cur->as_LoadIndexed () != NULL ) {
389
387
LoadIndexed *li = (LoadIndexed *)cur->as_LoadIndexed ();
390
388
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 ());
391
395
}
392
396
393
397
if (cur_invariant) {
@@ -412,6 +416,7 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
412
416
cur->set_exception_handlers (NULL );
413
417
414
418
TRACE_VALUE_NUMBERING (tty->print_cr (" Instruction %c%d is loop invariant" , cur->type ()->tchar (), cur->id ()));
419
+ TRACE_VALUE_NUMBERING (cur->print_line ());
415
420
416
421
if (cur->state_before () != NULL ) {
417
422
cur->set_state_before (_state->copy ());
@@ -421,7 +426,6 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
421
426
}
422
427
423
428
cur = prev->set_next (next);
424
-
425
429
} else {
426
430
prev = cur;
427
431
cur = cur->next ();
@@ -585,7 +589,7 @@ void GlobalValueNumbering::substitute(Instruction* instr) {
585
589
if (subst != instr) {
586
590
assert (!subst->has_subst (), " can't have a substitution" );
587
591
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 ()));
589
593
instr->set_subst (subst);
590
594
_has_substitutions = true ;
591
595
}
0 commit comments