public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/113164] New: [missed optimization] struct fields should not alias
@ 2023-12-28 14:55 powerboat9.gamer at gmail dot com
2023-12-28 18:22 ` [Bug middle-end/113164] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: powerboat9.gamer at gmail dot com @ 2023-12-28 14:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113164
Bug ID: 113164
Summary: [missed optimization] struct fields should not alias
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: powerboat9.gamer at gmail dot com
Target Milestone: ---
I have the following code
> struct sss {
> int a;
> int b;
> };
>
> int foo(struct sss *a, struct sss *b) {
> return &a->a == &b->b;
> }
When I compile it with
> gcc -c -O3 -Wall -Wextra test.c
I get
> 0000000000000000 <foo>:
> 0: 48 83 c6 04 add $0x4,%rsi
> 4: 31 c0 xor %eax,%eax
> 6: 48 39 fe cmp %rdi,%rsi
> 9: 0f 94 c0 sete %al
> c: c3 ret
, but GCC should be able to infer that the two pointers being compared can not
alias.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/113164] [missed optimization] struct fields should not alias
2023-12-28 14:55 [Bug middle-end/113164] New: [missed optimization] struct fields should not alias powerboat9.gamer at gmail dot com
@ 2023-12-28 18:22 ` pinskia at gcc dot gnu.org
2024-01-08 14:16 ` rguenth at gcc dot gnu.org
2024-05-16 12:47 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-28 18:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113164
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Keywords| |alias, missed-optimization
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/113164] [missed optimization] struct fields should not alias
2023-12-28 14:55 [Bug middle-end/113164] New: [missed optimization] struct fields should not alias powerboat9.gamer at gmail dot com
2023-12-28 18:22 ` [Bug middle-end/113164] " pinskia at gcc dot gnu.org
@ 2024-01-08 14:16 ` rguenth at gcc dot gnu.org
2024-05-16 12:47 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-08 14:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113164
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-01-08
Ever confirmed|0 |1
CC| |hubicka at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
This would rely on TBAA btw, with -fno-strict-aliasing we allow *a and *b
to overlap, aka
a = &b->b;
confirmed. I think we have all the bits in aliasing_component_refs_p and
friends, it just would need to be factored/wired up for addresses.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/113164] [missed optimization] struct fields should not alias
2023-12-28 14:55 [Bug middle-end/113164] New: [missed optimization] struct fields should not alias powerboat9.gamer at gmail dot com
2023-12-28 18:22 ` [Bug middle-end/113164] " pinskia at gcc dot gnu.org
2024-01-08 14:16 ` rguenth at gcc dot gnu.org
@ 2024-05-16 12:47 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-16 12:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113164
Bug 113164 depends on bug 13962, which changed state.
Bug 13962 Summary: [tree-ssa] make "fold" use alias information to optimize pointer comparisons
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=13962
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-16 12:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-28 14:55 [Bug middle-end/113164] New: [missed optimization] struct fields should not alias powerboat9.gamer at gmail dot com
2023-12-28 18:22 ` [Bug middle-end/113164] " pinskia at gcc dot gnu.org
2024-01-08 14:16 ` rguenth at gcc dot gnu.org
2024-05-16 12:47 ` 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).