]> git.ipfire.org Git - thirdparty/gcc.git/commit
forwprop: Allow nop conversions for vector constructor.
authorRobin Dapp <rdapp@ventanamicro.com>
Sun, 16 Nov 2025 17:42:04 +0000 (18:42 +0100)
committerRobin Dapp <rdapp@ventanamicro.com>
Mon, 24 Nov 2025 19:43:09 +0000 (20:43 +0100)
commit283eb27d5f674b6fb11d8640495993e2ec693608
tree3016d28b592ff697a938c9188a30926e27c2af3d
parent2d26dcdbcb43ca5b8a3d2e61c7defc3d8a3d55ce
forwprop: Allow nop conversions for vector constructor.

I observed a vect-construct forwprop opportunity in x264 that we
could handle when checking for a nop conversion instead of a useless
conversion.  IMHO a nop-conversion check is sufficient as we're only
dealing with permutations in simplify_vector_constructor.

This patch replaces uses of useless_type_conversion_p with
tree_nop_conversion_p in simplify_vector_constructor.

It was bootstrapped and regtested on x86 and power10, regtested on
aarch64 and riscv64.

There is a single scan-test failure on power
(gcc.target/powerpc/builtins-1.c).  The code actually looks better so
I took the liberty of adjusting the test expectation.

gcc/ChangeLog:

* tree-ssa-forwprop.cc (simplify_vector_constructor):
Allow nop conversions.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/builtins-1.c: Adjust test expectation.
* gcc.target/riscv/rvv/autovec/pr118019-3.c: New test.
gcc/testsuite/gcc.target/powerpc/builtins-1.c
gcc/testsuite/gcc.target/riscv/rvv/autovec/pr118019-3.c [new file with mode: 0644]
gcc/tree-ssa-forwprop.cc