8381872: C2: assert before block local scheduling failed with UseCompactObjectHeaders

Co-authored-by: Manuel Hässig <mhaessig@openjdk.org>
Co-authored-by: Quan Anh Mai <qamai@openjdk.org>
Reviewed-by: mhaessig, qamai
This commit is contained in:
Roman Kennke 2026-05-05 13:25:56 +00:00
parent ea40bcaaaa
commit 75cf33725b

View File

@ -25,6 +25,7 @@
#ifdef COMPILER2
#include "opto/addnode.hpp"
#include "opto/compile.hpp"
#include "peephole_x86_64.hpp"
#include "adfiles/ad_x86.hpp"
@ -343,10 +344,15 @@ bool Peephole::lea_remove_redundant(Block* block, int block_index, PhaseCFG* cfg
cfg_->map_node_to_block(proj, nullptr);
// Rewire the base of all leas currently depending on the decode we are removing.
// Use top() rather than a real value: leaP* emission does not consult Base, and the
// unused MachProj of decode confirms the derived oops produced by these leaP*s are
// not consumed by any OopMap. Avoiding a real input here also avoids creating a
// register conflict that would later be flagged by verify_good_schedule.
Node* top = Compile::current()->top();
for (DUIterator_Fast imax, i = decode->fast_outs(imax); i < imax; i++) {
Node* dependant_lea = decode->fast_out(i);
if (dependant_lea->is_Mach() && dependant_lea->as_Mach()->ideal_Opcode() == Op_AddP) {
dependant_lea->set_req(AddPNode::Base, lea_derived_oop->in(AddPNode::Address));
dependant_lea->set_req(AddPNode::Base, top);
// This deleted something in the out array, hence adjust i, imax.
--i;
--imax;