Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/ifg.cpp @ 20686:dc763d49b82d
8065618: C2 RA incorrectly removes kill projections
Summary: Don't remove KILL projections if their "defining" nodes have SCMemProj projection (memory side effects).
Reviewed-by: iveresov, roland
author | kvn |
---|---|
date | Tue, 02 Dec 2014 12:08:41 -0800 |
parents | 78bbf4d43a14 |
children | 3f4a5fdca318 |
comparison
equal
deleted
inserted
replaced
20685:0b86bdf28e07 | 20686:dc763d49b82d |
---|---|
539 if( !liveout.member(r) && n->Opcode() != Op_SafePoint ) { | 539 if( !liveout.member(r) && n->Opcode() != Op_SafePoint ) { |
540 Node *def = n->in(0); | 540 Node *def = n->in(0); |
541 if( !n->is_Proj() || | 541 if( !n->is_Proj() || |
542 // Could also be a flags-projection of a dead ADD or such. | 542 // Could also be a flags-projection of a dead ADD or such. |
543 (_lrg_map.live_range_id(def) && !liveout.member(_lrg_map.live_range_id(def)))) { | 543 (_lrg_map.live_range_id(def) && !liveout.member(_lrg_map.live_range_id(def)))) { |
544 if (n->is_MachProj()) { | |
545 // Don't remove KILL projections if their "defining" nodes have | |
546 // memory effects (have SCMemProj projection node) - | |
547 // they are not dead even when their result is not used. | |
548 // For example, compareAndSwapL (and other CAS) and EncodeISOArray nodes. | |
549 // The method add_input_to_liveout() keeps such nodes alive (put them on liveout list) | |
550 // when it sees SCMemProj node in a block. Unfortunately SCMemProj node could be placed | |
551 // in block in such order that KILL MachProj nodes are processed first. | |
552 uint cnt = def->outcnt(); | |
553 for (uint i = 0; i < cnt; i++) { | |
554 Node* proj = def->raw_out(i); | |
555 if (proj->Opcode() == Op_SCMemProj) { | |
556 return false; | |
557 } | |
558 } | |
559 } | |
544 block->remove_node(j - 1); | 560 block->remove_node(j - 1); |
545 if (lrgs(r)._def == n) { | 561 if (lrgs(r)._def == n) { |
546 lrgs(r)._def = 0; | 562 lrgs(r)._def = 0; |
547 } | 563 } |
548 n->disconnect_inputs(NULL, C); | 564 n->disconnect_inputs(NULL, C); |