public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/40135] using alias-set zero for union accesses necessary because of RTL alias oracle
2009-05-13 20:31 [Bug middle-end/40135] New: using alias-set zero for union accesses necessary because of RTL alias oracle rguenth at gcc dot gnu dot org
@ 2009-05-13 20:31 ` rguenth at gcc dot gnu dot org
0 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-13 20:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-05-13 20:31 -------
The tree alias oracle gets this right.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40135
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/40135] New: using alias-set zero for union accesses necessary because of RTL alias oracle
@ 2009-05-13 20:31 rguenth at gcc dot gnu dot org
2009-05-13 20:31 ` [Bug middle-end/40135] " rguenth at gcc dot gnu dot org
0 siblings, 1 reply; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-13 20:31 UTC (permalink / raw)
To: gcc-bugs
The RTL alias oracle does defer to TBAA even for the case of disambiguating
two accesses based on decls. This makes
/* Permit type-punning when accessing a union, provided the access
is directly through the union. For example, this code does not
permit taking the address of a union member and then storing
through it. Even the type-punning allowed here is a GCC
extension, albeit a common and useful one; the C standard says
that such accesses have implementation-defined behavior. */
for (u = t;
TREE_CODE (u) == COMPONENT_REF || TREE_CODE (u) == ARRAY_REF;
u = TREE_OPERAND (u, 0))
if (TREE_CODE (u) == COMPONENT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (u, 0))) == UNION_TYPE)
return 0;
in c-common.c necessary which needlessly pessimizes TBAA in the face
of union accesses.
--
Summary: using alias-set zero for union accesses necessary
because of RTL alias oracle
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: missed-optimization, alias
Severity: enhancement
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40135
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/40135] using alias-set zero for union accesses necessary because of RTL alias oracle
[not found] <bug-40135-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2014-09-08 14:21 ` rguenth at gcc dot gnu.org
@ 2014-09-09 9:00 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-09-09 9:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40135
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
For reference I see for example
FAIL: gcc.target/i386/avx2-vpblendd128-2.c execution test
FAIL: gcc.target/i386/avx2-vpblendd256-2.c execution test
FAIL: gcc.target/i386/avx2-vpblendw-2.c execution test
FAIL: gcc.target/i386/avx2-vpbroadcastd128-2.c execution test
FAIL: gcc.target/i386/avx2-vpbroadcastd256-2.c execution test
FAIL: gcc.target/i386/avx2-vpbroadcastw128-2.c execution test
FAIL: gcc.target/i386/avx2-vpbroadcastw256-2.c execution test
FAIL: gcc.target/i386/avx2-vpermd-2.c execution test
FAIL: gcc.target/i386/avx2-vpermps-2.c execution test
FAIL: gcc.target/i386/avx2-vpmaxsd-2.c execution test
FAIL: gcc.target/i386/avx2-vpmaxsw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmaxud-2.c execution test
FAIL: gcc.target/i386/avx2-vpmaxuw-2.c execution test
FAIL: gcc.target/i386/avx2-vpminsd-2.c execution test
FAIL: gcc.target/i386/avx2-vpminsw-2.c execution test
FAIL: gcc.target/i386/avx2-vpminud-2.c execution test
FAIL: gcc.target/i386/avx2-vpminuw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmuldq-2.c execution test
FAIL: gcc.target/i386/avx2-vpmulhrsw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmulhuw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmulhw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmulld-2.c execution test
...
FAIL: gcc.target/i386/avx2-vpunpckhdq-2.c execution test
FAIL: gcc.target/i386/avx2-vpunpckhwd-2.c execution test
FAIL: gcc.target/i386/avx2-vpunpckldq-2.c execution test
FAIL: gcc.target/i386/avx2-vpunpcklwd-2.c execution test
but for example gcc.target/i386/avx2-vpblendd128-2.c contains "invalid"
type-punning through unions:
static void
init_pblendd128 (int *src1, int *src2, int seed)
{
int i, sign = 1;
for (i = 0; i < 4; i++)
{
src1[i] = (i + seed) * (i + seed) * sign;
src2[i] = (i + seed + 20) * sign;
sign = -sign;
}
}
...
static void
avx2_test (void)
{
union128i_d src1, src2, dst;
int dst_ref[4];
int i;
for (i = 0; i < NUM; i++)
{
init_pblendd128 (src1.a, src2.a, i);
dst.x = _mm_blend_epi32 (src1.x, src2.x, MASK);
which stores into src1/src2 via a pointer access and only reads via a direct
access to the union.
That's not how the GCC extension specifies union type-punning. I've filed
PR63211 for that.
Here the stores do not end up in alias-set zero and with removing the
c-common.c hack the loads also end up not using alias-set zero. Without
the fix the loads use alias-set zero and thus keep the int-stores live.
There is also no easy must-alias to identify here as the stores happen
in a loop.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/40135] using alias-set zero for union accesses necessary because of RTL alias oracle
[not found] <bug-40135-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2014-09-08 14:12 ` rguenth at gcc dot gnu.org
@ 2014-09-08 14:21 ` rguenth at gcc dot gnu.org
2014-09-09 9:00 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-09-08 14:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40135
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Eventually just removing the call to mems_in_disjoint_alias_sets_p fixes the
rest (rtx_refs_may_alias_p will apply TBAA as well, _after_ positively
bailing out on the union punning).
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/40135] using alias-set zero for union accesses necessary because of RTL alias oracle
[not found] <bug-40135-4@http.gcc.gnu.org/bugzilla/>
2012-01-07 21:41 ` pinskia at gcc dot gnu.org
2014-09-08 14:11 ` rguenth at gcc dot gnu.org
@ 2014-09-08 14:12 ` rguenth at gcc dot gnu.org
2014-09-08 14:21 ` rguenth at gcc dot gnu.org
2014-09-09 9:00 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-09-08 14:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40135
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok it still has in the function comment
??? Contrary to the tree alias oracle this does not return
one for X + non-constant and Y + non-constant when X and Y are equal.
If that is fixed the TBAA hack for union type-punning can be removed. */
which explains what is remaining to do.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/40135] using alias-set zero for union accesses necessary because of RTL alias oracle
[not found] <bug-40135-4@http.gcc.gnu.org/bugzilla/>
2012-01-07 21:41 ` pinskia at gcc dot gnu.org
@ 2014-09-08 14:11 ` rguenth at gcc dot gnu.org
2014-09-08 14:12 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-09-08 14:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40135
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
At least improved (but maybe not fixed) by
2010-02-16 Richard Guenther <rguenther@suse.de>
* alias.c (memrefs_conflict_p): Distinguish must-alias from don't know.
(true_dependence): If memrefs_conflict_p computes must-alias
trust it. Move TBAA check after offset-based disambiguation.
(canon_true_dependence): Likewise.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/40135] using alias-set zero for union accesses necessary because of RTL alias oracle
[not found] <bug-40135-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-07 21:41 ` pinskia at gcc dot gnu.org
2014-09-08 14:11 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-07 21:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40135
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-01-07
Ever Confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-07 21:41:20 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-09-09 9:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-13 20:31 [Bug middle-end/40135] New: using alias-set zero for union accesses necessary because of RTL alias oracle rguenth at gcc dot gnu dot org
2009-05-13 20:31 ` [Bug middle-end/40135] " rguenth at gcc dot gnu dot org
[not found] <bug-40135-4@http.gcc.gnu.org/bugzilla/>
2012-01-07 21:41 ` pinskia at gcc dot gnu.org
2014-09-08 14:11 ` rguenth at gcc dot gnu.org
2014-09-08 14:12 ` rguenth at gcc dot gnu.org
2014-09-08 14:21 ` rguenth at gcc dot gnu.org
2014-09-09 9:00 ` 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).