mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8181872: C1: possible overflow when strength reducing integer multiply by constant
Reviewed-by: kvn
This commit is contained in:
parent
bc6e52c2b3
commit
2a0ab692f7
6 changed files with 68 additions and 15 deletions
|
@ -923,8 +923,8 @@ void LIRGenerator::do_ArithmeticOp_Int(ArithmeticOp* x) {
|
|||
} else {
|
||||
left_arg->load_item();
|
||||
if (x->op() == Bytecodes::_imul && right_arg->is_constant()) {
|
||||
int c = right_arg->get_jint_constant();
|
||||
if (c > 0 && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) {
|
||||
jint c = right_arg->get_jint_constant();
|
||||
if (c > 0 && c < max_jint && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) {
|
||||
right_arg->dont_load_item();
|
||||
} else {
|
||||
right_arg->load_item();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue