8288180: C2: VectorPhase must ensure that SafePointNode memory input is a MergeMemNode

Reviewed-by: roland, thartmann
This commit is contained in:
Emanuel Peter 2022-09-13 13:14:05 +00:00
parent 725f41ffd4
commit 6f2223faa1
2 changed files with 21 additions and 0 deletions
src/hotspot/share/opto
test/hotspot/jtreg/compiler/vectorapi

@ -163,6 +163,17 @@ static JVMState* clone_jvms(Compile* C, SafePointNode* sfpt) {
for (uint i = 0; i < size; i++) {
map->init_req(i, sfpt->in(i));
}
Node* mem = map->memory();
if (!mem->is_MergeMem()) {
// Since we are not in parsing, the SafePointNode does not guarantee that the memory
// input is necessarily a MergeMemNode. But we need to ensure that there is that
// MergeMemNode, since the GraphKit assumes the memory input of the map to be a
// MergeMemNode, so that it can directly access the memory slices.
PhaseGVN& gvn = *C->initial_gvn();
Node* mergemem = MergeMemNode::make(mem);
gvn.set_type_bottom(mergemem);
map->set_memory(mergemem);
}
new_jvms->set_map(map);
return new_jvms;
}

@ -36,6 +36,16 @@ import jdk.incubator.vector.VectorSpecies;
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeFill compiler.vectorapi.TestLoopStoreVector
*/
/*
* @test
* @bug 8288180
* @summary VectorPhase must ensure that SafePointNode's memory input is MergeMemNode, required for GraphKit
* @modules jdk.incubator.vector
*
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeFill -XX:+StressReflectiveCode compiler.vectorapi.TestLoopStoreVector
*/
public class TestLoopStoreVector {
static final VectorSpecies<Integer> SPECIESi = IntVector.SPECIES_PREFERRED;
static final VectorSpecies<Long> SPECIESl = LongVector.SPECIES_PREFERRED;