Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/postaloc.cpp @ 923:a70508bb21c3
6862863: C2 compiler fails in elide_copy()
Reviewed-by: kvn
author | never |
---|---|
date | Fri, 14 Aug 2009 15:53:46 -0700 |
parents | 98cb887364d3 |
children | 89e0543e1737 |
comparison
equal
deleted
inserted
replaced
904:ef671fb22f73 | 923:a70508bb21c3 |
---|---|
86 OptoReg::Name old_reg = lrgs(n2lidx(old)).reg(); | 86 OptoReg::Name old_reg = lrgs(n2lidx(old)).reg(); |
87 if( regnd && (*regnd)[old_reg]==old ) { // Instruction is currently available? | 87 if( regnd && (*regnd)[old_reg]==old ) { // Instruction is currently available? |
88 value->map(old_reg,NULL); // Yank from value/regnd maps | 88 value->map(old_reg,NULL); // Yank from value/regnd maps |
89 regnd->map(old_reg,NULL); // This register's value is now unknown | 89 regnd->map(old_reg,NULL); // This register's value is now unknown |
90 } | 90 } |
91 assert(old->req() <= 2, "can't handle more inputs"); | |
91 Node *tmp = old->req() > 1 ? old->in(1) : NULL; | 92 Node *tmp = old->req() > 1 ? old->in(1) : NULL; |
92 old->disconnect_inputs(NULL); | 93 old->disconnect_inputs(NULL); |
93 if( !tmp ) break; | 94 if( !tmp ) break; |
94 old = tmp; | 95 old = tmp; |
95 } | 96 } |
528 OptoReg::Name nreg = lrgs(lidx).reg(); | 529 OptoReg::Name nreg = lrgs(lidx).reg(); |
529 // Skip through all copies to the _value_ being defined. | 530 // Skip through all copies to the _value_ being defined. |
530 // Do not change from int to pointer | 531 // Do not change from int to pointer |
531 Node *val = skip_copies(n); | 532 Node *val = skip_copies(n); |
532 | 533 |
534 // Clear out a dead definition before starting so that the | |
535 // elimination code doesn't have to guard against it. The | |
536 // definition could in fact be a kill projection with a count of | |
537 // 0 which is safe but since those are uninteresting for copy | |
538 // elimination just delete them as well. | |
539 if (regnd[nreg] != NULL && regnd[nreg]->outcnt() == 0) { | |
540 regnd.map(nreg, NULL); | |
541 value.map(nreg, NULL); | |
542 } | |
543 | |
533 uint n_ideal_reg = n->ideal_reg(); | 544 uint n_ideal_reg = n->ideal_reg(); |
534 if( is_single_register(n_ideal_reg) ) { | 545 if( is_single_register(n_ideal_reg) ) { |
535 // If Node 'n' does not change the value mapped by the register, | 546 // If Node 'n' does not change the value mapped by the register, |
536 // then 'n' is a useless copy. Do not update the register->node | 547 // then 'n' is a useless copy. Do not update the register->node |
537 // mapping so 'n' will go dead. | 548 // mapping so 'n' will go dead. |
538 if( value[nreg] != val ) { | 549 if( value[nreg] != val ) { |
539 if (eliminate_copy_of_constant(val, n, b, value, regnd, nreg, OptoReg::Bad)) { | 550 if (eliminate_copy_of_constant(val, n, b, value, regnd, nreg, OptoReg::Bad)) { |
540 n->replace_by(regnd[nreg]); | 551 j -= replace_and_yank_if_dead(n, nreg, b, value, regnd); |
541 j -= yank_if_dead(n,b,&value,®nd); | |
542 } else { | 552 } else { |
543 // Update the mapping: record new Node defined by the register | 553 // Update the mapping: record new Node defined by the register |
544 regnd.map(nreg,n); | 554 regnd.map(nreg,n); |
545 // Update mapping for defined *value*, which is the defined | 555 // Update mapping for defined *value*, which is the defined |
546 // Node after skipping all copies. | 556 // Node after skipping all copies. |
547 value.map(nreg,val); | 557 value.map(nreg,val); |
548 } | 558 } |
549 } else if( !may_be_copy_of_callee(n) && regnd[nreg]->outcnt() != 0 ) { | 559 } else if( !may_be_copy_of_callee(n) ) { |
550 assert( n->is_Copy(), "" ); | 560 assert( n->is_Copy(), "" ); |
551 n->replace_by(regnd[nreg]); | 561 j -= replace_and_yank_if_dead(n, nreg, b, value, regnd); |
552 j -= yank_if_dead(n,b,&value,®nd); | |
553 } | 562 } |
554 } else { | 563 } else { |
555 // If the value occupies a register pair, record same info | 564 // If the value occupies a register pair, record same info |
556 // in both registers. | 565 // in both registers. |
557 OptoReg::Name nreg_lo = OptoReg::add(nreg,-1); | 566 OptoReg::Name nreg_lo = OptoReg::add(nreg,-1); |
563 tmp.Remove(nreg); | 572 tmp.Remove(nreg); |
564 nreg_lo = tmp.find_first_elem(); | 573 nreg_lo = tmp.find_first_elem(); |
565 } | 574 } |
566 if( value[nreg] != val || value[nreg_lo] != val ) { | 575 if( value[nreg] != val || value[nreg_lo] != val ) { |
567 if (eliminate_copy_of_constant(val, n, b, value, regnd, nreg, nreg_lo)) { | 576 if (eliminate_copy_of_constant(val, n, b, value, regnd, nreg, nreg_lo)) { |
568 n->replace_by(regnd[nreg]); | 577 j -= replace_and_yank_if_dead(n, nreg, b, value, regnd); |
569 j -= yank_if_dead(n,b,&value,®nd); | |
570 } else { | 578 } else { |
571 regnd.map(nreg , n ); | 579 regnd.map(nreg , n ); |
572 regnd.map(nreg_lo, n ); | 580 regnd.map(nreg_lo, n ); |
573 value.map(nreg ,val); | 581 value.map(nreg ,val); |
574 value.map(nreg_lo,val); | 582 value.map(nreg_lo,val); |
575 } | 583 } |
576 } else if( !may_be_copy_of_callee(n) && regnd[nreg]->outcnt() != 0 ) { | 584 } else if( !may_be_copy_of_callee(n) ) { |
577 assert( n->is_Copy(), "" ); | 585 assert( n->is_Copy(), "" ); |
578 n->replace_by(regnd[nreg]); | 586 j -= replace_and_yank_if_dead(n, nreg, b, value, regnd); |
579 j -= yank_if_dead(n,b,&value,®nd); | |
580 } | 587 } |
581 } | 588 } |
582 | 589 |
583 // Fat projections kill many registers | 590 // Fat projections kill many registers |
584 if( n_ideal_reg == MachProjNode::fat_proj ) { | 591 if( n_ideal_reg == MachProjNode::fat_proj ) { |