public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113255] [11/12/13/14 Regression] wrong code with -O2 -mtune=k8 Date: Tue, 23 Jan 2024 07:08:52 +0000 [thread overview] Message-ID: <bug-113255-4-IV72OhaFlP@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113255-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113255 --- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:a98d5130a6dcff2ed4db371e500550134777b8cf commit r14-8346-ga98d5130a6dcff2ed4db371e500550134777b8cf Author: Richard Biener <rguenther@suse.de> Date: Mon Jan 15 12:55:20 2024 +0100 rtl-optimization/113255 - base_alias_check vs. pointer difference When the x86 backend generates code for cpymem with the rep_8byte strathegy for the 8 byte aligned main rep movq it needs to compute an adjusted pointer to the source after doing a prologue aligning the destination. It computes that via src_ptr + (dest_ptr - orig_dest_ptr) which is perfectly fine. On RTL this is then 8: r134:DI=const(`g'+0x44) 9: {r133:DI=frame:DI-0x4c;clobber flags:CC;} REG_UNUSED flags:CC 56: r129:DI=const(`g'+0x4c) 57: {r129:DI=r129:DI&0xfffffffffffffff8;clobber flags:CC;} REG_UNUSED flags:CC REG_EQUAL const(`g'+0x4c)&0xfffffffffffffff8 58: {r118:DI=r134:DI-r129:DI;clobber flags:CC;} REG_DEAD r134:DI REG_UNUSED flags:CC REG_EQUAL const(`g'+0x44)-r129:DI 59: {r119:DI=r133:DI-r118:DI;clobber flags:CC;} REG_DEAD r133:DI REG_UNUSED flags:CC but as written find_base_term happily picks the first candidate it finds for the MINUS which means it picks const(`g') rather than the correct frame:DI. This way find_base_term (but also the unfixed find_base_value used by init_alias_analysis to initialize REG_BASE_VALUE) performs pointer analysis isn't sound. The following restricts the handling of multi-operand operations to the case we know only one can be a pointer. This for example causes gcc.dg/tree-ssa/pr94969.c to miss some RTL PRE (I've opened PR113395 for this). A more drastic patch, removing base_alias_check results in only gcc.dg/guality/pr41447-1.c regressing (so testsuite coverage is bad). I've looked at gcc.dg/tree-ssa tests and mostly scheduling changes are present, the cc1plus .text size is only 230 bytes worse. With the this less drastic patch below most scheduling changes are gone. x86_64 might not the very best target to test for impact, but test coverage on other targets is unlikely to be very much better. PR rtl-optimization/113255 * alias.cc (find_base_term): Remove PLUS/MINUS handling when both operands are not CONST_INT_P. * gcc.dg/torture/pr113255.c: New testcase.
next prev parent reply other threads:[~2024-01-23 7:08 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-06 23:24 [Bug c/113255] New: " mednafen at sent dot com 2024-01-06 23:53 ` [Bug target/113255] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org 2024-01-07 12:13 ` jakub at gcc dot gnu.org 2024-01-07 19:48 ` ubizjak at gmail dot com 2024-01-09 7:52 ` rguenth at gcc dot gnu.org 2024-01-09 7:58 ` jakub at gcc dot gnu.org 2024-01-09 8:00 ` ubizjak at gmail dot com 2024-01-09 9:27 ` jakub at gcc dot gnu.org 2024-01-09 10:20 ` rguenth at gcc dot gnu.org 2024-01-09 12:09 ` rguenth at gcc dot gnu.org 2024-01-10 8:57 ` rguenth at gcc dot gnu.org 2024-01-12 8:48 ` rguenth at gcc dot gnu.org 2024-01-23 7:08 ` cvs-commit at gcc dot gnu.org [this message] 2024-01-23 7:10 ` [Bug target/113255] [11/12/13 " rguenth at gcc dot gnu.org 2024-01-23 14:38 ` cvs-commit at gcc dot gnu.org 2024-02-01 12:53 ` rguenth at gcc dot gnu.org 2024-02-01 13:08 ` rguenth at gcc dot gnu.org 2024-02-05 7:35 ` cvs-commit 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-113255-4-IV72OhaFlP@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).