tree-optimization/111019 - invariant motion and aliasing
commit745ec2135aabfbe2c0fb7780309837d17e8986d4
authorRichard Biener <rguenther@suse.de>
Thu, 17 Aug 2023 13:21:33 +0000 (17 15:21 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 18 Aug 2023 13:04:48 +0000 (18 15:04 +0200)
treecace58db1231dc2feb420dac5f24b84305790328
parent35b5762a740d4506d7acac65d0f8375640362492
tree-optimization/111019 - invariant motion and aliasing

The following fixes a bad choice in representing things to the alias
oracle by LIM which while correct in pieces is inconsistent with itself.
When canonicalizing a ref to a bare deref instead of leaving the base
object and the extracted offset the same and just substituting an
alternate ref the following replaces the base and the offset as well,
avoiding the confusion that otherwise will arise in
aliasing_matching_component_refs_p.

PR tree-optimization/111019
* tree-ssa-loop-im.cc (gather_mem_refs_stmt): When canonicalizing
also scrap base and offset in case the ref is indirect.

* g++.dg/torture/pr111019.C: New testcase.
gcc/testsuite/g++.dg/torture/pr111019.C [new file with mode: 0644]
gcc/tree-ssa-loop-im.cc