diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-04-11 10:44:28 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-04-11 10:44:28 +0200 |
commit | a42aa68bf1ad745a6b36ab9beed1fc2e77ac3f88 (patch) | |
tree | 188792bf816e9f0a2238c2773fd4d36425a958c5 /gcc/config.gcc | |
parent | 083e8e66d2e90992fa83a53bfc3553dfa91abda1 (diff) | |
download | gcc-a42aa68bf1ad745a6b36ab9beed1fc2e77ac3f88.zip gcc-a42aa68bf1ad745a6b36ab9beed1fc2e77ac3f88.tar.gz gcc-a42aa68bf1ad745a6b36ab9beed1fc2e77ac3f88.tar.bz2 |
phiopt: Optimize (x != cst1 ? x : cst2) != cst3 [PR104639]
Here is an attempt to resolve a P1 regression, where due to threading
changes we no longer optimize
bool foo(int i) {
while (i == 4)
i += 2;
return i;
}
to just return i != 0; by enhancing the phiopt value_replacement
optimization. Normally it will optimize x != cst1 ? x : cst1 to x.
Here we extend it to also optimize x != cst1 ? x : cst2 to x if
it (phi result) has a single immediate use which is a comparison
with some INTEGER_CST cst3 and we can prove that we don't care
whether x is cst1 or cst2 because both compare the same against cst3.
2022-04-11 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/104639
* tree-ssa-phiopt.cc: Include tree-ssa-propagate.h.
(value_replacement): Optimize (x != cst1 ? x : cst2) != cst3
into x != cst3.
* gcc.dg/tree-ssa/pr104639-1.c: New test.
* gcc.dg/tree-ssa/pr104639-2.c: New test.
Diffstat (limited to 'gcc/config.gcc')
0 files changed, 0 insertions, 0 deletions