With SVE we can end up with:
switch (POLY_INT_CST [2, 2]) <default: <L2> [INV], case 2: <L3> [INV], case 4: <L3> [INV]>
which is fine to expand and we can remove the assert.
gcc/ChangeLog:
PR tree-optimization/96915
* tree-switch-conversion.c (switch_conversion::expand): Accept
also integer constants.
gcc/testsuite/ChangeLog:
PR tree-optimization/96915
* gcc.target/aarch64/sve/pr96915.c: New test.
--- /dev/null
+/* PR tree-optimization/96915 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=armv8.2-a+sve" } */
+
+#pragma GCC aarch64 "arm_sve.h"
+void b() {
+ switch (svcntd())
+ case 2:
+ case 4:
+ b();
+}
during gimplification). */
gcc_checking_assert (TREE_TYPE (m_index_expr) != error_mark_node);
- /* A switch on a constant should have been optimized in tree-cfg-cleanup. */
- gcc_checking_assert (!TREE_CONSTANT (m_index_expr));
-
/* Prefer bit test if possible. */
if (tree_fits_uhwi_p (m_range_size)
&& bit_test_cluster::can_be_handled (tree_to_uhwi (m_range_size), m_uniq)