public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/61894] New: Fail to fold read from constant vector initializer
@ 2014-07-24 10:34 rguenth at gcc dot gnu.org
2014-07-24 10:37 ` [Bug middle-end/61894] " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-24 10:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61894
Bug ID: 61894
Summary: Fail to fold read from constant vector initializer
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
The following is not handled by fold_const_aggregate_ref and siblings.
/* { dg-do run } */
/* { dg-options "-O" } */
extern void abort (void);
/* We should fold all reads from xconstant and eliminate it, removing
the reference to blah which cannot be resolved at link time. */
extern int blah;
typedef int v4si __attribute__((vector_size(16)));
static const struct {
int *y;
const v4si x[2] __attribute__((aligned(32)));
} xconstant = { &blah, { { 0, 1, 2, 3 }, { 2, 3, 4, 5 } } };
int main()
{
if (sizeof (int) != 4)
return 0;
if (*(int *)&xconstant.x[0][0] != 0)
abort ();
if (*(int *)&xconstant.x[0][1] != 1)
if (*(int *)&xconstant.x[0][2] != 2)
abort ();
if (*(int *)&xconstant.x[0][3] != 3)
abort ();
if (*(int *)&xconstant.x[1][0] != 2)
abort ();
if (*(int *)&xconstant.x[1][1] != 3)
abort ();
if (*(int *)&xconstant.x[1][2] != 4)
abort ();
if (*(int *)&xconstant.x[1][3] != 5)
abort ();
return 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61894] Fail to fold read from constant vector initializer
2014-07-24 10:34 [Bug middle-end/61894] New: Fail to fold read from constant vector initializer rguenth at gcc dot gnu.org
@ 2014-07-24 10:37 ` rguenth at gcc dot gnu.org
2014-07-24 10:37 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-24 10:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61894
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Because fold_ctor_reference doesn't handle VECTOR_CST.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61894] Fail to fold read from constant vector initializer
2014-07-24 10:34 [Bug middle-end/61894] New: Fail to fold read from constant vector initializer rguenth at gcc dot gnu.org
2014-07-24 10:37 ` [Bug middle-end/61894] " rguenth at gcc dot gnu.org
@ 2014-07-24 10:37 ` rguenth at gcc dot gnu.org
2014-07-25 7:45 ` rguenth at gcc dot gnu.org
2014-07-25 7:46 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-24 10:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61894
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-07-24
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61894] Fail to fold read from constant vector initializer
2014-07-24 10:34 [Bug middle-end/61894] New: Fail to fold read from constant vector initializer rguenth at gcc dot gnu.org
2014-07-24 10:37 ` [Bug middle-end/61894] " rguenth at gcc dot gnu.org
2014-07-24 10:37 ` rguenth at gcc dot gnu.org
@ 2014-07-25 7:45 ` rguenth at gcc dot gnu.org
2014-07-25 7:46 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-25 7:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61894
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Jul 25 07:44:57 2014
New Revision: 213045
URL: https://gcc.gnu.org/viewcvs?rev=213045&root=gcc&view=rev
Log:
2014-07-25 Richard Biener <rguenther@suse.de>
PR middle-end/61762
PR middle-end/61894
* fold-const.c (native_encode_int): Add and handle offset
parameter to do partial encodings of expr.
(native_encode_fixed): Likewise.
(native_encode_real): Likewise.
(native_encode_complex): Likewise.
(native_encode_vector): Likewise.
(native_encode_string): Likewise.
(native_encode_expr): Likewise.
* fold-const.c (native_encode_expr): Add offset parameter
defaulting to -1.
* gimple-fold.c (fold_string_cst_ctor_reference): Remove.
(fold_ctor_reference): Handle all reads from tcc_constant
ctors.
* gcc.dg/pr61762.c: New testcase.
* gcc.dg/fold-cstring.c: Likewise.
* gcc.dg/fold-cvect.c: Likewise.
Added:
trunk/gcc/testsuite/gcc.dg/fold-cstring.c
trunk/gcc/testsuite/gcc.dg/fold-cvect.c
trunk/gcc/testsuite/gcc.dg/pr61762.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/fold-const.h
trunk/gcc/gimple-fold.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61894] Fail to fold read from constant vector initializer
2014-07-24 10:34 [Bug middle-end/61894] New: Fail to fold read from constant vector initializer rguenth at gcc dot gnu.org
` (2 preceding siblings ...)
2014-07-25 7:45 ` rguenth at gcc dot gnu.org
@ 2014-07-25 7:46 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-25 7:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61894
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-07-25 7:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-24 10:34 [Bug middle-end/61894] New: Fail to fold read from constant vector initializer rguenth at gcc dot gnu.org
2014-07-24 10:37 ` [Bug middle-end/61894] " rguenth at gcc dot gnu.org
2014-07-24 10:37 ` rguenth at gcc dot gnu.org
2014-07-25 7:45 ` rguenth at gcc dot gnu.org
2014-07-25 7:46 ` 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).