8261812: C2 compilation fails with assert(!had_error) failed: bad dominance

Reviewed-by: kvn, thartmann
This commit is contained in:
Roland Westrelin 2021-03-05 15:43:24 +00:00
parent 97557826f5
commit 2c0507ecd6
6 changed files with 170 additions and 23 deletions

View file

@ -4793,3 +4793,27 @@ void Compile::igv_print_method_to_network(const char* phase_name) {
void Compile::add_native_invoker(RuntimeStub* stub) {
_native_invokers.append(stub);
}
Node* Compile::narrow_value(BasicType bt, Node* value, const Type* type, PhaseGVN* phase, bool transform_res) {
if (type != NULL && phase->type(value)->higher_equal(type)) {
return value;
}
Node* result = NULL;
if (bt == T_BYTE) {
result = phase->transform(new LShiftINode(value, phase->intcon(24)));
result = new RShiftINode(result, phase->intcon(24));
} else if (bt == T_BOOLEAN) {
result = new AndINode(value, phase->intcon(0xFF));
} else if (bt == T_CHAR) {
result = new AndINode(value,phase->intcon(0xFFFF));
} else {
assert(bt == T_SHORT, "unexpected narrow type");
result = phase->transform(new LShiftINode(value, phase->intcon(16)));
result = new RShiftINode(result, phase->intcon(16));
}
if (transform_res) {
result = phase->transform(result);
}
return result;
}