From 7b92998dff6aafafb3333c761dc1dedb8a245f0d Mon Sep 17 00:00:00 2001 From: April Ivy Date: Sat, 25 Apr 2026 10:32:04 +0000 Subject: [PATCH] 8379722: C2: assert that result is used for CallLeafPureNode in final graph reshaping Reviewed-by: qamai, aseoane, vlivanov --- src/hotspot/share/opto/compile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 8da4342419b..6d185a9746e 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -3234,6 +3234,12 @@ void Compile::final_graph_reshaping_impl(Node *n, Final_Reshape_Counts& frc, Uni assert(mb->trailing_membar()->leading_membar() == mb, "bad membar pair"); } } + if (n->is_CallLeafPure()) { + // A pure call whose result projection is unused should have been + // eliminated by CallLeafPureNode::Ideal during IGVN. + assert(n->as_CallLeafPure()->proj_out_or_null(TypeFunc::Parms) != nullptr, + "unused CallLeafPureNode should have been removed before final graph reshaping"); + } #endif // Count FPU ops and common calls, implements item (3) bool gc_handled = BarrierSet::barrier_set()->barrier_set_c2()->final_graph_reshaping(this, n, nop, dead_nodes);