diff options
author | Martin Liska <mliska@suse.cz> | 2020-09-21 12:50:37 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-09-21 13:52:03 +0200 |
commit | d726ecd9554a805d4a5e044cb21ca23a7f7ca49f (patch) | |
tree | d46e807c6d9a1889a586d0154ad0cd68d3972345 /gcc | |
parent | 48b0c1250a5c7d72be6b3fbbb1117d1cce43daee (diff) | |
download | gcc-d726ecd9554a805d4a5e044cb21ca23a7f7ca49f.zip gcc-d726ecd9554a805d4a5e044cb21ca23a7f7ca49f.tar.gz gcc-d726ecd9554a805d4a5e044cb21ca23a7f7ca49f.tar.bz2 |
Fix ICE in tree-switch-conversion.
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/sve/pr96915.c | 11 | ||||
-rw-r--r-- | gcc/tree-switch-conversion.c | 3 |
2 files changed, 11 insertions, 3 deletions
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 0000000..fae4cd4 --- /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 4b43594..186411f 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) |