public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hailey.chiu at sifive dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/90594] [9/10/11 regression] Spurious popcount emitted Date: Tue, 23 Jun 2020 06:29:45 +0000 [thread overview] Message-ID: <bug-90594-4-eX9GdRrAGQ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-90594-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90594 Hsiao-Hui Chiu <hailey.chiu at sifive dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hailey.chiu at sifive dot com --- Comment #6 from Hsiao-Hui Chiu <hailey.chiu at sifive dot com> --- Hi, I got the same issue that my program is compiled with gcc-10.1 with riscv. Here is my code, C source: void foo() { static long *a; static int i; static int sum; sum = 0; for ( i = 1 ; i < n ; i++) { sum += (*a--); } } Compiling with riscv-gcc-10.1, with -Os, riscv-gcc-10.1/riscv64-unknown-elf-gcc -Os -march=rv32imac -mabi=ilp32 -S -o foo.s foo.c Asm: foo: ...skip... .L6: addi a7,a7,1 bgt a5,a7,.L7 li a4,0 ble a5,zero,.L9 li a4,-4 mul a4,a5,a4 addi a4,a4,4 #a = -4*n + 4 .L9: add a4,a0,a4 bgt a5,zero,.L10 li a5,1 .L10: beq t3,zero,.L5 sw a4,%lo(a.1)(a1) sw a6,%lo(sum.3)(a2) sw a5,%lo(i.2)(a3) .L5: ret .L7: lw a4,0(t1) li t3,1 addi t1,t1,-4 #a-- add a6,a6,a4 j .L6 That .L6 segment is totally redundant. By inspecting the gcc trace, this is happening at SCCP pass as this reported bug described. But, when I compiled the bad_popcount function, I didn't see any redundant code emitted. According previous comments, I know this is under fixing. I am just wondering if there is anything updated between last May to now? Thanks.
next prev parent reply other threads:[~2020-06-23 6:29 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-90594-4@http.gcc.gnu.org/bugzilla/> 2020-03-12 11:58 ` [Bug tree-optimization/90594] [9/10 " jakub at gcc dot gnu.org 2020-06-23 6:29 ` hailey.chiu at sifive dot com [this message] 2020-06-23 8:20 ` [Bug tree-optimization/90594] [9/10/11 " rguenth at gcc dot gnu.org 2021-06-01 8:14 ` [Bug tree-optimization/90594] [9/10/11/12 " rguenth at gcc dot gnu.org 2022-05-27 9:40 ` [Bug tree-optimization/90594] [10/11/12/13 " rguenth at gcc dot gnu.org 2022-06-28 10:37 ` jakub at gcc dot gnu.org 2023-07-07 10:35 ` [Bug tree-optimization/90594] [11/12/13/14 " rguenth 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-90594-4-eX9GdRrAGQ@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).