8267982: Set the node after peephole optimization to be removed

Reviewed-by: kvn, thartmann
This commit is contained in:
sunguoyun 2021-07-08 09:12:35 +00:00 committed by Tobias Hartmann
parent 4fbcce119b
commit 2c883eeed4
3 changed files with 13 additions and 2 deletions

@ -1342,6 +1342,9 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch
assert( false, "ShouldNotReachHere();");
}
for (int i = 0; i <= max_position; i++) {
fprintf(fp, " inst%d->set_removed();\n", i);
}
// Return the new sub-tree
fprintf(fp, " deleted = %d;\n", max_position+1 /*zero to one based*/);
fprintf(fp, " return root; // return new root;\n");

@ -466,8 +466,11 @@ static void do_liveness(PhaseRegAlloc* regalloc, PhaseCFG* cfg, Block_List* work
assert(def != 0, "input edge required");
int first = regalloc->get_reg_first(def);
int second = regalloc->get_reg_second(def);
if( OptoReg::is_valid(first) ) set_live_bit(tmp_live,first);
if( OptoReg::is_valid(second) ) set_live_bit(tmp_live,second);
//If peephole had removed the node,do not set live bit for it.
if (!(def->is_Mach() && def->as_Mach()->get_removed())) {
if (OptoReg::is_valid(first)) set_live_bit(tmp_live,first);
if (OptoReg::is_valid(second)) set_live_bit(tmp_live,second);
}
// If we use the stack pointer in a cisc-alternative instruction,
// check for use as a memory operand. Then reconstruct the RegName
// for this stack location, and set the appropriate bit in the

@ -204,6 +204,9 @@ public:
// Base type for all machine specific nodes. All node classes generated by the
// ADLC inherit from this class.
class MachNode : public Node {
private:
bool _removed = false;
public:
MachNode() : Node((uint)0), _barrier(0), _num_opnds(0), _opnds(NULL) {
init_class_id(Class_Mach);
@ -372,6 +375,8 @@ public:
// Returns true if this node is a check that can be implemented with a trap.
virtual bool is_TrapBasedCheckNode() const { return false; }
void set_removed() { _removed = true; }
bool get_removed() { return _removed; }
#ifndef PRODUCT
virtual const char *Name() const = 0; // Machine-specific name