public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/66379] New: SCCVN doesn't handle aggregate array element accesses very well
@ 2015-06-02 13:31 rguenth at gcc dot gnu.org
2021-05-04 13:17 ` [Bug tree-optimization/66379] " rguenth at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-02 13:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66379
Bug ID: 66379
Summary: SCCVN doesn't handle aggregate array element accesses
very well
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Blocks: 66142
Target Milestone: ---
struct X { int i; int j; };
struct X a[128];
int foo (int i)
{
struct X x;
x.i = i;
x.j = 0;
a[i] = x;
return a[i].i;
}
should ideally optimize to return i;
But first, FRE is confused by SRA:
<bb 2>:
_4 = &a[i_2(D)];
MEM[(struct X *)_4] = i_2(D);
MEM[(struct X *)_4 + 4B] = 0;
_6 = a[i_2(D)].i;
return _6;
and second (if SRA is disabled),
<bb 2>:
x.i = i_2(D);
x.j = 0;
a[i_2(D)] = x;
_6 = a[i_2(D)].i;
x ={v} {CLOBBER};
return _6;
the aggregate copy lookthrough code is too simple here (offset-based
stuff just bails out with variable indexes). Using stmt_kills_ref_p
helps for this case but it does not for the testcase in PR66142.
@@ -1879,7 +1895,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree
|| handled_component_p (gimple_assign_rhs1 (def_stmt))))
{
tree base2;
- HOST_WIDE_INT offset2, size2, maxsize2;
+ HOST_WIDE_INT maxsize2;
int i, j;
auto_vec<vn_reference_op_s> rhs;
vn_reference_op_t vro;
@@ -1890,8 +1906,6 @@ vn_reference_lookup_3 (ao_ref *ref, tree
/* See if the assignment kills REF. */
base2 = ao_ref_base (&lhs_ref);
- offset2 = lhs_ref.offset;
- size2 = lhs_ref.size;
maxsize2 = lhs_ref.max_size;
if (maxsize2 == -1
|| (base != base2
@@ -1900,8 +1914,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree
|| TREE_OPERAND (base, 0) != TREE_OPERAND (base2, 0)
|| !tree_int_cst_equal (TREE_OPERAND (base, 1),
TREE_OPERAND (base2, 1))))
- || offset2 > offset
- || offset2 + size2 < offset + maxsize)
+ || !stmt_kills_ref_p (def_stmt, ref))
return (void *)-1;
/* Find the common base of ref and the lhs. lhs_ops already
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66142
[Bug 66142] Loop is not vectorized because not sufficient support for
GOMP_SIMD_LANE
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/66379] SCCVN doesn't handle aggregate array element accesses very well
2015-06-02 13:31 [Bug tree-optimization/66379] New: SCCVN doesn't handle aggregate array element accesses very well rguenth at gcc dot gnu.org
@ 2021-05-04 13:17 ` rguenth at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-04 13:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66379
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |10.1.0
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Known to fail| |8.4.1, 9.3.1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 10+.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-04 13:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-02 13:31 [Bug tree-optimization/66379] New: SCCVN doesn't handle aggregate array element accesses very well rguenth at gcc dot gnu.org
2021-05-04 13:17 ` [Bug tree-optimization/66379] " rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).