]> git.ipfire.org Git - thirdparty/gcc.git/commit
forwprop: Pun with integer type if needed [PR123799].
authorRobin Dapp <rdapp@oss.qualcomm.com>
Sat, 24 Jan 2026 21:07:07 +0000 (22:07 +0100)
committerRobin Dapp <rdapp@oss.qualcomm.com>
Tue, 27 Jan 2026 12:26:20 +0000 (13:26 +0100)
commit0accf2b4dff933915ae75a154d268c79fc7ea5b9
treeb0548c17f259466eb42897343ab8c5fa385a0b99
parent1284cefa89b2579c0a91134d8f5d93ef7f2b66f3
forwprop: Pun with integer type if needed [PR123799].

We cannot directly build vectors from BitInts, which this patch
circumvents by punning  the conversion element type with an integer
type.  This results in two separate conversions at the gimple level.
Those don't appear to cause worse final code, though.  It is possible to
merge those two conversions at the construction site but from what I can
tell would involve more changes than necessary now, so I refrained from
it.

Before this patch we would check tree_nop_conversion_p for e.g.
BitInt _12 = BIT_FIELD_REF (vector unsigned int).  This is a
"nop conversion" but the implicit assumption is that we can build
a vector type from the lhs type that can be nop-converted back to
the original type.  This is not true for BitInt.

Bootstrapped and regtested on x86, power10, and aarch64.
Regtested on riscv64.

PR tree-optimization/123799

gcc/ChangeLog:

* tree-ssa-forwprop.cc (simplify_vector_constructor): Pun
conversion element type with integer type.

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr123799.c: New test.
gcc/testsuite/gcc.dg/torture/pr123799.c [new file with mode: 0644]
gcc/tree-ssa-forwprop.cc