public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/65215] [5 Regression] Bswap load miscompilation Date: Thu, 26 Feb 2015 12:46:00 -0000 [thread overview] Message-ID: <bug-65215-4-R0dV8eZDMT@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-65215-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65215 --- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #9) > (In reply to Thomas Preud'homme from comment #5) > > (In reply to Richard Biener from comment #4) > > > (In reply to Jakub Jelinek from comment #1) > > > > Created attachment 34879 [details] > > > > gcc5-pr65215.patch > > > > > > > > Untested fix. There are still issues left, e.g. I can't understand the > > > > "bswap &&" part in > > > > if (bswap > > > > && align < GET_MODE_ALIGNMENT (TYPE_MODE (load_type)) > > > > && SLOW_UNALIGNED_ACCESS (TYPE_MODE (load_type), align)) > > > > return false; > > > > Don't you use the new MEM_REF even for the !bswap (aka nop) case? So, I > > > > don't see how it would be safe to generate that. > > > > And the testsuite coverage of this is definitely suboptimal, from endianity > > > > POV, bitfields etc. > > > > > > I suggested that change (remove bswap &&) multiple times, but it got lost > > > appearantly. (I even remember applying that change myself!?) And what I changed was Index: tree-ssa-math-opts.c =================================================================== --- tree-ssa-math-opts.c (revision 212067) +++ tree-ssa-math-opts.c (revision 212068) @@ -2179,7 +2179,9 @@ bswap_replace (gimple cur_stmt, gimple_s unsigned align; align = get_object_alignment (src); - if (bswap && SLOW_UNALIGNED_ACCESS (TYPE_MODE (load_type), align)) + if (bswap + && align < GET_MODE_ALIGNMENT (TYPE_MODE (load_type)) + && SLOW_UNALIGNED_ACCESS (TYPE_MODE (load_type), align)) return false; gsi_move_before (&gsi, &gsi_ins); > > > > I remember the contrary as this was the reason PR61320 was investigated in > > the first place. This idea is that if it's unaligned the expander will take > > care of this and that they would be at least as efficient as what the user > > code was doing to avoid doing an unaligned load. > > Ah indeed. The idea is that the expander should be able to produce the > most optimal and canonical form for an unaligned load on those targets, > especially for say loading a 4-byte value from a 2-byte aligned source > where the source had 4 individual char loads. > > > I'm happy to revisit that position though. > > No - I just stand corrected. > > > Best regards, > > > > Thomas
next prev parent reply other threads:[~2015-02-26 11:45 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-02-26 0:27 [Bug tree-optimization/65215] New: " jakub at gcc dot gnu.org 2015-02-26 0:44 ` [Bug tree-optimization/65215] " jakub at gcc dot gnu.org 2015-02-26 11:07 ` jakub at gcc dot gnu.org 2015-02-26 11:17 ` jakub at gcc dot gnu.org 2015-02-26 11:32 ` jakub at gcc dot gnu.org 2015-02-26 11:36 ` rguenth at gcc dot gnu.org 2015-02-26 11:45 ` jakub at gcc dot gnu.org 2015-02-26 11:45 ` thopre01 at gcc dot gnu.org 2015-02-26 12:28 ` thopre01 at gcc dot gnu.org 2015-02-26 12:37 ` jakub at gcc dot gnu.org 2015-02-26 12:39 ` rguenth at gcc dot gnu.org 2015-02-26 12:46 ` rguenth at gcc dot gnu.org [this message] 2015-02-26 22:50 ` jakub at gcc dot gnu.org 2015-02-27 0:21 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-65215-4-R0dV8eZDMT@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).