]> git.ipfire.org Git - thirdparty/gcc.git/commit
VN: Canonicalize compares before calling vn_nary_op_lookup_pieces
authorAndrew Pinski <quic_apinski@quicinc.com>
Thu, 7 Nov 2024 17:40:15 +0000 (09:40 -0800)
committerAndrew Pinski <quic_apinski@quicinc.com>
Sat, 9 Nov 2024 16:20:33 +0000 (08:20 -0800)
commitaf1277b4d0d274b8c8f6edffcee32b7f39f2df64
treeee20065a5a89ffdd4a0ce95afec4de75b7b8a53f
parent0284886b8eb6f64676a56c420325ab0a9f911e70
VN: Canonicalize compares before calling vn_nary_op_lookup_pieces

This is the followup as mentioned in
https://gcc.gnu.org/pipermail/gcc-patches/2024-November/667987.html .
We need to canonicalize the compares using tree_swap_operands_p instead
of checking CONSTANT_CLASS_P.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-sccvn.cc (visit_phi): Swap the operands
before calling vn_nary_op_lookup_pieces if
tree_swap_operands_p returns true.
(insert_predicates_for_cond): Use tree_swap_operands_p
instead of checking for CONSTANT_CLASS_P.
(process_bb): Swap the comparison and operands
if tree_swap_operands_p returns true.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/tree-ssa-sccvn.cc