From: Martin Liska Date: Mon, 21 Sep 2020 10:50:37 +0000 (+0200) Subject: Fix ICE in tree-switch-conversion. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d726ecd9554a805d4a5e044cb21ca23a7f7ca49f;p=gcc.git Fix ICE in tree-switch-conversion. With SVE we can end up with: switch (POLY_INT_CST [2, 2]) [INV], case 2: [INV], case 4: [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. --- diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr96915.c b/gcc/testsuite/gcc.target/aarch64/sve/pr96915.c new file mode 100644 index 00000000000..fae4cd42117 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr96915.c @@ -0,0 +1,11 @@ +/* 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(); +} diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index 4b435941d12..186411ff3c4 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -984,9 +984,6 @@ switch_conversion::expand (gswitch *swtch) 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)