Skip to content

Commit a531c9a

Browse files
benoitmaillardeme64
authored andcommitted
8361144: Strenghten the Ideal Verification in PhaseIterGVN::verify_Ideal_for by comparing the hash of a node before and after Ideal
Co-authored-by: Emanuel Peter <epeter@openjdk.org> Reviewed-by: galder, dfenacci, epeter
1 parent 99c299f commit a531c9a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/hotspot/share/opto/phaseX.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,8 @@ bool PhaseIterGVN::verify_Ideal_for(Node* n, bool can_reshape) {
18181818

18191819
// The number of nodes shoud not increase.
18201820
uint old_unique = C->unique();
1821-
1821+
// The hash of a node should not change, this would indicate different inputs
1822+
uint old_hash = n->hash();
18221823
Node* i = n->Ideal(this, can_reshape);
18231824
// If there was no new Idealization, we are probably happy.
18241825
if (i == nullptr) {
@@ -1832,6 +1833,16 @@ bool PhaseIterGVN::verify_Ideal_for(Node* n, bool can_reshape) {
18321833
return true;
18331834
}
18341835

1836+
if (old_hash != n->hash()) {
1837+
stringStream ss; // Print as a block without tty lock.
1838+
ss.cr();
1839+
ss.print_cr("Ideal optimization did not make progress but node hash changed.");
1840+
ss.print_cr(" old_hash = %d, hash = %d", old_hash, n->hash());
1841+
n->dump_bfs(1, nullptr, "", &ss);
1842+
tty->print_cr("%s", ss.as_string());
1843+
return true;
1844+
}
1845+
18351846
verify_empty_worklist(n);
18361847

18371848
// Everything is good.

0 commit comments

Comments
 (0)