public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/115346] New: [15] Volatile load elimination with packed struct bitfields at -O2 @ 2024-06-04 17:11 patrick at rivosinc dot com 2024-06-04 17:24 ` [Bug middle-end/115346] [15] Volatile load elimination with packed struct bitfields pinskia at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: patrick at rivosinc dot com @ 2024-06-04 17:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115346 Bug ID: 115346 Summary: [15] Volatile load elimination with packed struct bitfields at -O2 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: patrick at rivosinc dot com Target Milestone: --- Testcase: #pragma pack(1) struct a { unsigned b; long c : 33; unsigned d : 31; }; volatile struct a h[40]; int main() { for (int i = 0; i < 40; i++) { h[0]; } } -O3 asm output: main: xor eax, eax ret h: .zero 480 Removing the pack pragma causes the loads to be emitted. Godbolt: https://godbolt.org/z/3YfrbzdPz GCC 4.0.4 does not eliminate the loads: https://godbolt.org/z/frsP8o7YT ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/115346] [15] Volatile load elimination with packed struct bitfields 2024-06-04 17:11 [Bug middle-end/115346] New: [15] Volatile load elimination with packed struct bitfields at -O2 patrick at rivosinc dot com @ 2024-06-04 17:24 ` pinskia at gcc dot gnu.org 2024-06-04 17:30 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-06-04 17:24 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115346 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- >GCC 4.0.4 does not eliminate the loads: https://godbolt.org/z/frsP8o7YT But 3.4.6 did not emit them either. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/115346] [15] Volatile load elimination with packed struct bitfields 2024-06-04 17:11 [Bug middle-end/115346] New: [15] Volatile load elimination with packed struct bitfields at -O2 patrick at rivosinc dot com 2024-06-04 17:24 ` [Bug middle-end/115346] [15] Volatile load elimination with packed struct bitfields pinskia at gcc dot gnu.org @ 2024-06-04 17:30 ` pinskia at gcc dot gnu.org 2024-06-04 17:36 ` pinskia at gcc dot gnu.org 2024-06-05 7:01 ` rguenth at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-06-04 17:30 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115346 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note this is not even emitted at -O0, the gimplifier removes it for some reason ... ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/115346] [15] Volatile load elimination with packed struct bitfields 2024-06-04 17:11 [Bug middle-end/115346] New: [15] Volatile load elimination with packed struct bitfields at -O2 patrick at rivosinc dot com 2024-06-04 17:24 ` [Bug middle-end/115346] [15] Volatile load elimination with packed struct bitfields pinskia at gcc dot gnu.org 2024-06-04 17:30 ` pinskia at gcc dot gnu.org @ 2024-06-04 17:36 ` pinskia at gcc dot gnu.org 2024-06-05 7:01 ` rguenth at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-06-04 17:36 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115346 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #2) > Note this is not even emitted at -O0, the gimplifier removes it for some > reason ... Oh see PR 99258 for analysis of the gimplifier (I think). with `#pragma pack(1)`, the struct becomes BLKmode. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/115346] [15] Volatile load elimination with packed struct bitfields 2024-06-04 17:11 [Bug middle-end/115346] New: [15] Volatile load elimination with packed struct bitfields at -O2 patrick at rivosinc dot com ` (2 preceding siblings ...) 2024-06-04 17:36 ` pinskia at gcc dot gnu.org @ 2024-06-05 7:01 ` rguenth at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu.org @ 2024-06-05 7:01 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115346 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- duplicate *** This bug has been marked as a duplicate of bug 99258 *** ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-05 7:01 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-06-04 17:11 [Bug middle-end/115346] New: [15] Volatile load elimination with packed struct bitfields at -O2 patrick at rivosinc dot com 2024-06-04 17:24 ` [Bug middle-end/115346] [15] Volatile load elimination with packed struct bitfields pinskia at gcc dot gnu.org 2024-06-04 17:30 ` pinskia at gcc dot gnu.org 2024-06-04 17:36 ` pinskia at gcc dot gnu.org 2024-06-05 7:01 ` 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).