From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B44DC385041B; Wed, 8 Mar 2023 03:16:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B44DC385041B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678245414; bh=L2h5mgB8TbjAkpC/uCE75yCLD/JNdB8dR3lE5tPn9z4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NKpPCBJ5kgwhEpu/n6ORuUGCSV/OfjffQwVKOAkEM92ZEBGQJrq+D4lePu7flHi19 SsJJgDnJsyOKh1pgejvb2RysRuxSM4BlK4vffZpqWiEwxBfG4pwDVQwxWblngtKP76 cog8stqY+BwkBQv5Dm7g/IdASkRAiq//pg7f3QjY= From: "chenglulu at loongson dot cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/109035] meaningless memory store on RISC-V and LoongArch Date: Wed, 08 Mar 2023 03:16:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: chenglulu at loongson dot cn X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109035 chenglulu changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chenglulu at loongson dot = cn --- Comment #2 from chenglulu --- I think this is most likely caused by the implementation of the public code= . If the immediate value is set to be large enough, such as 0xfffffff, aarch64 a= lso has the same problem. $ cat t.c int test(int x) { char buf[0xfffffff]; return buf[x]; } $ ./cc1 t.c -o - -O2 2>/dev/null | grep test -A20 test: .LFB0: .cfi_startproc mov x12, 16 mov x2, 16 movk x12, 0x1000, lsl 16 sub sp, sp, x12 .cfi_def_cfa_offset 268435472 movk x2, 0x1000, lsl 16 mov x1, -268435456 add x1, x2, x1 add x1, sp, x1 str x1, [sp, 8] ldrb w0, [x1, w0, sxtw] add sp, sp, x12 .cfi_def_cfa_offset 0 ret The "str x1, [sp, 8]" instruction also has the same problem.=