public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/50262] New: PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments
@ 2011-09-01 9:58 jakub at gcc dot gnu.org
2011-09-01 11:11 ` [Bug middle-end/50262] " rguenth at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-09-01 9:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50262
Bug #: 50262
Summary: PTA doesn't disambiguate locally allocated heap
objects from pointed to by arguments
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jakub@gcc.gnu.org
CC: rguenth@gcc.gnu.org
char *r;
char
foo (char *p, int len)
{
char *q = __builtin_malloc (len);
*p = 1;
*q = 2;
r = q;
return *p;
}
doesn't optimize return *p; into return 1; even when *q store can't alias *p.
This matters e.g. for the string length optimization I'm working on.
Testcase for the latter is e.g.:
#include <string.h>
#include <stdlib.h>
char *
foo (char *p, char *r)
{
char *q = malloc (strlen (p) + strlen (r) + 64);
if (q == NULL) return NULL;
strcpy (q, p);
strcat (q, "/");
strcat (q, "abcde");
strcat (q, r);
strcat (q, "/");
return q;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/50262] PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments
2011-09-01 9:58 [Bug middle-end/50262] New: PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments jakub at gcc dot gnu.org
@ 2011-09-01 11:11 ` rguenth at gcc dot gnu.org
2011-09-29 13:02 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-01 11:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50262
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |alias
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-09-01
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-01 11:10:21 UTC ---
Mine. I have some partial patches somewhere and at least an idea how to
start to disentangle the mess that causes us to give up here.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/50262] PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments
2011-09-01 9:58 [Bug middle-end/50262] New: PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments jakub at gcc dot gnu.org
2011-09-01 11:11 ` [Bug middle-end/50262] " rguenth at gcc dot gnu.org
@ 2011-09-29 13:02 ` rguenth at gcc dot gnu.org
2013-11-15 10:59 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-29 13:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50262
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-29 12:35:32 UTC ---
Not disambiguated because the HEAP tag of q escapes and thus the points-to
set of q has vars_contains_global set, which then aliases with p which
just has nonlocal set.
We'd probably need a vars_contains_nonlocal and vars_contains_escaped
to distinguish the flow-sensitivity of nonlocal vs. escaped also in
the generated points-to info.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/50262] PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments
2011-09-01 9:58 [Bug middle-end/50262] New: PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments jakub at gcc dot gnu.org
2011-09-01 11:11 ` [Bug middle-end/50262] " rguenth at gcc dot gnu.org
2011-09-29 13:02 ` rguenth at gcc dot gnu.org
@ 2013-11-15 10:59 ` rguenth at gcc dot gnu.org
2013-11-15 14:48 ` rguenth at gcc dot gnu.org
2013-11-15 14:49 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-15 10:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50262
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I finally have a patch ...
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/50262] PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments
2011-09-01 9:58 [Bug middle-end/50262] New: PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2013-11-15 10:59 ` rguenth at gcc dot gnu.org
@ 2013-11-15 14:48 ` rguenth at gcc dot gnu.org
2013-11-15 14:49 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-15 14:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50262
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Nov 15 14:48:22 2013
New Revision: 204845
URL: http://gcc.gnu.org/viewcvs?rev=204845&root=gcc&view=rev
Log:
2013-11-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/50262
* tree-ssa-alias.h (struct pt_solution): Split
vars_contains_global into vars_contains_nonlocal,
vars_contains_escaped and vars_contains_escaped_heap.
* tree-ssa-structalias.c (label_visit): Expand comment.
(handle_lhs_call): Adjust comment.
(set_uids_in_ptset): Set the new flags appropriately.
(pt_solution_set): Adjust.
(pt_solution_set_var): Likewise.
(pt_solution_ior_into): Likewise.
(pt_solution_includes_global): Likewise.
(pt_solutions_intersect_1): Optimize escaped handling.
(compute_points_to_sets): Remove heap variable globalization.
(ipa_escaped_pt): Adjust initializer.
(pass_data_ipa_pta): Do not run TODO_update_ssa.
* gimple-pretty-print.c (pp_points_to_solution): Print split
flags.
* tree-ssa-alias.c (dump_points_to_solution): Likewise.
* gcc.dg/tree-ssa/alias-28.c: New testcase.
* gcc.dg/strlenopt-1.c: Adjust.
* gcc.dg/strlenopt-1f.c: Likewise.
Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/alias-28.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-pretty-print.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/strlenopt-1.c
trunk/gcc/testsuite/gcc.dg/strlenopt-1f.c
trunk/gcc/tree-ssa-alias.c
trunk/gcc/tree-ssa-alias.h
trunk/gcc/tree-ssa-structalias.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/50262] PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments
2011-09-01 9:58 [Bug middle-end/50262] New: PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2013-11-15 14:48 ` rguenth at gcc dot gnu.org
@ 2013-11-15 14:49 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-15 14:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50262
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |4.9.0
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-11-15 14:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-01 9:58 [Bug middle-end/50262] New: PTA doesn't disambiguate locally allocated heap objects from pointed to by arguments jakub at gcc dot gnu.org
2011-09-01 11:11 ` [Bug middle-end/50262] " rguenth at gcc dot gnu.org
2011-09-29 13:02 ` rguenth at gcc dot gnu.org
2013-11-15 10:59 ` rguenth at gcc dot gnu.org
2013-11-15 14:48 ` rguenth at gcc dot gnu.org
2013-11-15 14:49 ` 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).