tree-optimization/109154 - improve if-conversion for vectorization
authorRichard Biener <rguenther@suse.de>
Tue, 28 Mar 2023 13:20:22 +0000 (15:20 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 29 Mar 2023 06:33:00 +0000 (08:33 +0200)
commitc9954996cd647daf0ba03e34dd279b97982f671f
treef51a515351d496e17ae4475d93848c2db3b81c9b
parent91293ffb6af18705ab7857dc47656bdd74a9ce31
tree-optimization/109154 - improve if-conversion for vectorization

With multi-argument PHIs and now doing VN on the if-converted blocks
the optimization of CSEing condition and negated condition doesn't
work well anymore.  The following restores this a little bit for
the case of a single inverted condition into a COND_EXPR where
we can instead swap the COND_EXPR arms.  The same optimization
is already done for the case of two-argument PHIs.

This avoids one comparison/mask for the testcase at hand.

PR tree-optimization/109154
* tree-if-conv.cc (gen_phi_arg_condition): Handle single
inverted condition specially by inverting at the caller.
(gen_phi_arg_condition): Swap COND_EXPR arms if requested.
gcc/tree-if-conv.cc