]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/113895 - copy_reference_ops_from_ref vs. bitfields
authorRichard Biener <rguenther@suse.de>
Tue, 13 Feb 2024 10:10:57 +0000 (11:10 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 13 Feb 2024 12:42:02 +0000 (13:42 +0100)
commit94225dfb5623725fa519eac69338f7a632a509ae
treec6369fed1a1833157ede8eb92f94f18da8dafc14
parentefc71fd57539421c3939b1fe7594862d0fc66cdb
tree-optimization/113895 - copy_reference_ops_from_ref vs. bitfields

The recent enhancement to discover constant array indices by range
info used by get_ref_base_and_extent doesn't work when the outermost
component reference is to a bitfield because we track the running
offset in the reference ops as bytes.  The following does as
ao_ref_init_from_vn_reference and recovers that manually, tracking
the offset for the purpose of discovering the constant array index
in bits instead.

PR tree-optimization/113895
* tree-ssa-sccvn.cc (copy_reference_ops_from_ref): Track
offset to discover constant array indices in bits, handle
COMPONENT_REF to bitfields.

* gcc.dg/torture/pr113895-1.c: New testcase.
gcc/testsuite/gcc.dg/torture/pr113895-1.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.cc