]> git.ipfire.org Git - thirdparty/gcc.git/commit
if-to-switch: properly allow side effects only for first condition
authorMartin Liska <mliska@suse.cz>
Thu, 30 Jun 2022 13:00:17 +0000 (15:00 +0200)
committerMartin Liska <mliska@suse.cz>
Fri, 1 Jul 2022 06:47:49 +0000 (08:47 +0200)
commit618bac5b486832edd3f8eb3ada74740e389dfcb8
tree9a11a53e55fbfe9f15dd98c4d036866f857166bb
parent33981253cdf4505af30d3467ba5baa142cc62772
if-to-switch: properly allow side effects only for first condition

Properly allow side effects only for a first BB in a condition chain.

PR tree-optimization/106126

gcc/ChangeLog:

* gimple-if-to-switch.cc (struct condition_info): Save
has_side_effect.
(find_conditions): Parse all BBs.
(pass_if_to_switch::execute): Allow only side effects for first
BB.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr106126.c: New test.
gcc/gimple-if-to-switch.cc
gcc/testsuite/gcc.dg/tree-ssa/pr106126.c [new file with mode: 0644]