diff options
author | Martin Liska <mliska@suse.cz> | 2020-12-08 13:18:37 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-12-08 21:02:51 +0100 |
commit | f7251a2c103bc48775cb9726a4bebeaebde96684 (patch) | |
tree | 1c5b090164fd7d975b75e4751e904cc750171222 /gcc/gimple-if-to-switch.cc | |
parent | dded5f78ccb785520804444871a7b6ca4b735370 (diff) | |
download | gcc-f7251a2c103bc48775cb9726a4bebeaebde96684.zip gcc-f7251a2c103bc48775cb9726a4bebeaebde96684.tar.gz gcc-f7251a2c103bc48775cb9726a4bebeaebde96684.tar.bz2 |
if-to-switch: fix matching of negative conditions
gcc/ChangeLog:
PR tree-optimization/98182
* gimple-if-to-switch.cc (pass_if_to_switch::execute): Request
chain linkage through false edges only.
gcc/testsuite/ChangeLog:
PR tree-optimization/98182
* gcc.dg/tree-ssa/if-to-switch-10.c: New test.
* gcc.dg/tree-ssa/pr98182.c: New test.
Diffstat (limited to 'gcc/gimple-if-to-switch.cc')
-rw-r--r-- | gcc/gimple-if-to-switch.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/gimple-if-to-switch.cc b/gcc/gimple-if-to-switch.cc index 8e1043a..311f6f6 100644 --- a/gcc/gimple-if-to-switch.cc +++ b/gcc/gimple-if-to-switch.cc @@ -522,6 +522,12 @@ pass_if_to_switch::execute (function *fun) if (!info2 || info->m_ranges[0].exp != info2->m_ranges[0].exp) break; + /* It is important that the blocks are linked through FALSE_EDGE. + For an expression of index != VALUE, true and false edges + are flipped. */ + if (info2->m_false_edge != e) + break; + chain->m_entries.safe_push (info2); bitmap_set_bit (seen_bbs, e->src->index); info = info2; |