diff options
author | Richard Biener <rguenther@suse.de> | 2023-07-05 15:57:49 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-07-06 09:30:13 +0200 |
commit | 9f4f833455bb35c11d03e93f802604ac7cd8b740 (patch) | |
tree | e1bc33d2f18a8d7dfbeb159f03ea74bf9d9d7e64 /gcc/tree-vect-loop-manip.cc | |
parent | f2b37c8a38e44696287b19856bcbbf52e8b004f8 (diff) | |
download | gcc-9f4f833455bb35c11d03e93f802604ac7cd8b740.zip gcc-9f4f833455bb35c11d03e93f802604ac7cd8b740.tar.gz gcc-9f4f833455bb35c11d03e93f802604ac7cd8b740.tar.bz2 |
tree-optimization/110515 - wrong code with LIM + PRE
In this PR we face the issue that LIM speculates a load when
hoisting it out of the loop (since it knows it cannot trap).
Unfortunately this exposes undefined behavior when the load
accesses memory with the wrong dynamic type. This later
makes PRE use that representation instead of the original
which accesses the same memory location but using a different
dynamic type leading to a wrong disambiguation of that
original access against another and thus a wrong-code transform.
Fortunately there already is code in PRE dealing with a similar
situation for code hoisting but that left a small gap which
when fixed also fixes the wrong-code transform in this bug even
if it doesn't address the underlying issue of LIM speculating
that load.
The upside is this fix is trivially safe to backport and chances
of code generation regressions are very low.
PR tree-optimization/110515
* tree-ssa-pre.cc (compute_avail): Make code dealing
with hoisting loads with different alias-sets more
robust.
* g++.dg/opt/pr110515.C: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop-manip.cc')
0 files changed, 0 insertions, 0 deletions