Skip to content

Commit 2c883ee

Browse files
sunny868TobiHartmann
authored andcommitted
8267982: Set the node after peephole optimization to be removed
Reviewed-by: kvn, thartmann
1 parent 4fbcce1 commit 2c883ee

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/hotspot/share/adlc/output_c.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,9 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch
13421342
assert( false, "ShouldNotReachHere();");
13431343
}
13441344

1345+
for (int i = 0; i <= max_position; i++) {
1346+
fprintf(fp, " inst%d->set_removed();\n", i);
1347+
}
13451348
// Return the new sub-tree
13461349
fprintf(fp, " deleted = %d;\n", max_position+1 /*zero to one based*/);
13471350
fprintf(fp, " return root; // return new root;\n");

src/hotspot/share/opto/buildOopMap.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,11 @@ static void do_liveness(PhaseRegAlloc* regalloc, PhaseCFG* cfg, Block_List* work
466466
assert(def != 0, "input edge required");
467467
int first = regalloc->get_reg_first(def);
468468
int second = regalloc->get_reg_second(def);
469-
if( OptoReg::is_valid(first) ) set_live_bit(tmp_live,first);
470-
if( OptoReg::is_valid(second) ) set_live_bit(tmp_live,second);
469+
//If peephole had removed the node,do not set live bit for it.
470+
if (!(def->is_Mach() && def->as_Mach()->get_removed())) {
471+
if (OptoReg::is_valid(first)) set_live_bit(tmp_live,first);
472+
if (OptoReg::is_valid(second)) set_live_bit(tmp_live,second);
473+
}
471474
// If we use the stack pointer in a cisc-alternative instruction,
472475
// check for use as a memory operand. Then reconstruct the RegName
473476
// for this stack location, and set the appropriate bit in the

src/hotspot/share/opto/machnode.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ class MachOper : public ResourceObj {
204204
// Base type for all machine specific nodes. All node classes generated by the
205205
// ADLC inherit from this class.
206206
class MachNode : public Node {
207+
private:
208+
bool _removed = false;
209+
207210
public:
208211
MachNode() : Node((uint)0), _barrier(0), _num_opnds(0), _opnds(NULL) {
209212
init_class_id(Class_Mach);
@@ -372,6 +375,8 @@ class MachNode : public Node {
372375

373376
// Returns true if this node is a check that can be implemented with a trap.
374377
virtual bool is_TrapBasedCheckNode() const { return false; }
378+
void set_removed() { _removed = true; }
379+
bool get_removed() { return _removed; }
375380

376381
#ifndef PRODUCT
377382
virtual const char *Name() const = 0; // Machine-specific name

0 commit comments

Comments
 (0)