From 554e60c400746746bb55469e61fad84af365dbf5 Mon Sep 17 00:00:00 2001
From: Wang Huang <whuang@openjdk.org>
Date: Wed, 6 Jan 2021 01:49:15 +0000
Subject: [PATCH] 8258989: JVM is failed to inline in
 jdk.internal.vm.vector.VectorSupport::convert

Co-authored-by: He Xuejin <hexuejin2@huawei.com>
Reviewed-by: vlivanov, thartmann
---
 src/hotspot/share/opto/vectorIntrinsics.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp
index 07036d2ca7b..bf6db23e1b9 100644
--- a/src/hotspot/share/opto/vectorIntrinsics.cpp
+++ b/src/hotspot/share/opto/vectorIntrinsics.cpp
@@ -1435,7 +1435,7 @@ bool LibraryCallKit::inline_vector_convert() {
     } else if (num_elem_from > num_elem_to) {
       // Since number elements from input is larger than output, simply reduce size of input (we are supposed to
       // drop top elements anyway).
-      int num_elem_for_resize = MAX2(num_elem_to, Matcher::min_vector_size(elem_bt_to));
+      int num_elem_for_resize = MAX2(num_elem_to, Matcher::min_vector_size(elem_bt_from));
 
       // It is possible that arch does not support this intermediate vector size
       // TODO More complex logic required here to handle this corner case for the sizes.