diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2025-02-13 20:23:48 -0800 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2025-04-18 09:13:47 -0700 |
commit | 16082bdc6beef1ca1485ed5ccdc0c52aabbe0f4c (patch) | |
tree | 72bc39c244ff2276dfe91ef812b193180ebceead /libjava/gnu | |
parent | 7b4849ec79873fa6de98436deda47e19cbac32ef (diff) | |
download | gcc-16082bdc6beef1ca1485ed5ccdc0c52aabbe0f4c.zip gcc-16082bdc6beef1ca1485ed5ccdc0c52aabbe0f4c.tar.gz gcc-16082bdc6beef1ca1485ed5ccdc0c52aabbe0f4c.tar.bz2 |
gimple: Canonical order for invariants [PR118902]
So unlike constants, address invariants are currently put first if
used with a SSA NAME.
It would be better if address invariants are consistent with constants
and this patch changes that.
gcc.dg/tree-ssa/pr118902-1.c is an example where this canonicalization
can help. In it if `p` variable was a global variable, FRE (VN) would have figured
it out that `a` could never be equal to `&p` inside the loop. But without the
canonicalization we end up with `&p == a.0_1` which VN does try to handle for conditional
VN.
Bootstrapped and tested on x86_64.
PR tree-optimization/118902
gcc/ChangeLog:
* fold-const.cc (tree_swap_operands_p): Place invariants in the first operand
if not used with constants.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr118902-1.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'libjava/gnu')
0 files changed, 0 insertions, 0 deletions