]> git.ipfire.org Git - people/ms/gcc.git/commit
reassoc: Fold some statements [PR108819]
authorJakub Jelinek <jakub@redhat.com>
Sat, 18 Feb 2023 11:40:49 +0000 (12:40 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sun, 19 Mar 2023 05:28:51 +0000 (06:28 +0100)
commit7a596c323a9c6af5e8825d2d99892452da7a4e58
treef7f333429e797b0df4a1e8431be3fdb7617707ce
parentf9f1d3e7ddc8ca940500947e77a8775bb5864107
reassoc: Fold some statements [PR108819]

This spot in update_ops can replace one or both of the assign operands with
constants, creating 1 & 1 and similar expressions which can confuse later
passes until they are folded.  Rather than folding both constants by hand
and also handling swapping of operands for commutative ops if the first one
is constant and second one is not, the following patch just uses
fold_stmt_inplace to do that.  I think we shouldn't fold more than the
single statement because that could screw up the rest of the pass, we'd have
to mark all those with uids, visited and the like.

2023-02-18  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/108819
* tree-ssa-reassoc.cc (update_ops): Fold new stmt in place.

* gcc.dg/pr108819.c: New test.

(cherry picked from commit 32b5875c911f80d551d006d7473e6f1f8705857a)
gcc/testsuite/gcc.dg/pr108819.c [new file with mode: 0644]
gcc/tree-ssa-reassoc.cc