Need to check if the tree's code is SSA_NAME before SSA_NAME_RANGE_INFO.
2024-07-03 Hu, Lin1 <lin1.hu@intel.com>
Andrew Pinski <quic_apinski@quicinc.com>
gcc/ChangeLog:
PR tree-optimization/115753
* tree-vect-stmts.cc (supportable_indirect_convert_operation): Add
TYPE_CODE check before SSA_NAME_RANGE_INFO.
gcc/testsuite/ChangeLog:
PR tree-optimization/115753
* gcc.dg/vect/pr115753-1.c: New test.
* gcc.dg/vect/pr115753-2.c: Ditto.
* gcc.dg/vect/pr115753-3.c: Ditto.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -frounding-math" } */
+/* { dg-add-options float16 } */
+/* { dg-require-effective-target float16 } */
+
+void f(_Complex _Float16*);
+void
+foo1 (_Complex _Float16 *d)
+{
+ _Complex _Float16 cf = 3967 + 3791 * 1i;
+ f(&cf);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -frounding-math" } */
+/* { dg-add-options float16 } */
+/* { dg-require-effective-target float16 } */
+
+void f(_Float16*);
+void
+foo1 ()
+{
+ int t0 = 3967;
+ int t1 = 3969;
+ int t2 = 3971;
+ int t3 = 3973;
+ _Float16 tt[4];
+ tt[0] = t0;
+ tt[1] = t1;
+ tt[2] = t2;
+ tt[3] = t3;
+ f(&tt[0]);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -frounding-math" } */
+
+void f(float*);
+void
+foo1 ()
+{
+ long long t0 = __LONG_LONG_MAX__;
+ long long t1 = __LONG_LONG_MAX__ - 1;
+ float tt[2];
+ tt[0] = t0;
+ tt[1] = t1;
+ f(&tt[0]);
+}
+
In the future, if it is supported, changes may need to be made
to this part, such as checking the RANGE of each element
in the vector. */
- if (!SSA_NAME_RANGE_INFO (op0)
+ if ((TREE_CODE (op0) == SSA_NAME && !SSA_NAME_RANGE_INFO (op0))
|| !vect_get_range_info (op0, &op_min_value, &op_max_value))
break;