changeset 9452:c42cb799628c

8266191: Missing aarch64 parts of JDK-8181872(C1: possible overflow when strength reducing integer multiply by constant) Reviewed-by: kvn, aph
author vlivanov
date Wed, 28 Apr 2021 15:21:39 +0800
parents 2c95a7981541
children d24969e49a6a
files src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp	Fri Dec 18 20:23:26 2015 +0300
+++ b/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp	Wed Apr 28 15:21:39 2021 +0800
@@ -603,12 +603,12 @@
   } else {
     assert (x->op() == Bytecodes::_imul, "expect imul");
     if (right.is_constant()) {
-      int c = right.get_jint_constant();
-      if (! is_power_of_2(c) && ! is_power_of_2(c + 1) && ! is_power_of_2(c - 1)) {
+      jint c = right.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 {
         // Cannot use constant op.
-        right.load_item();
-      } else {
-        right.dont_load_item();
+        right_arg->load_item();
       }
     } else {
       right.load_item();