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 target/107250] Load unnecessarily happens before malloc
Date: Fri, 14 Oct 2022 07:37:39 +0000	[thread overview]
Message-ID: <bug-107250-4-AkCzIStzx7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107250-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107250

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
          Component|tree-optimization           |target
            Version|unknown                     |13.0
   Last reconfirmed|                            |2022-10-14
             Status|UNCONFIRMED                 |NEW
             Target|                            |x86_64-*-*
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The question is _why_ we generate worse code ... looks like pro/epilogue
generation differs:

@@ -11,15 +11,19 @@
 Attempting shrink-wrapping optimization.
 Block 2 needs prologue due to insn 2:
 (insn 2 4 3 2 (set (reg/v/f:DI 3 bx [orig:84 f ] [84])
-        (reg:DI 5 di [87])) "t.c":4:23 82 {*movdi_internal}
+        (reg:DI 5 di [86])) "t.c":4:23 82 {*movdi_internal}
      (nil))
 After wrapping required blocks, PRO is now 2
 Avoiding non-duplicatable blocks, PRO is now 2
 Bumping back to anticipatable blocks, PRO is now 2
...
     1: NOTE_INSN_DELETED
     4: NOTE_INSN_BASIC_BLOCK 2
-   18: [--sp:DI]=bx:DI
-   19: NOTE_INSN_PROLOGUE_END
+   18: [--sp:DI]=bp:DI
+   19: [--sp:DI]=bx:DI
+   20: {sp:DI=sp:DI-0x8;clobber flags:CC;clobber [scratch];}
+      REG_CFA_ADJUST_CFA sp:DI=sp:DI-0x8
+   21: NOTE_INSN_PROLOGUE_END
     2: bx:DI=di:DI
     3: NOTE_INSN_FUNCTION_BEG
-    6: di:DI=0x8
-    7: ax:DI=call [`malloc'] argc:0
+    6: bp:DI=[bx:DI]
+    7: di:DI=0x8
+    8: ax:DI=call [`malloc'] argc:0
       REG_CALL_DECL `malloc'
       REG_EH_REGION 0
-   10: dx:DI=[bx:DI]
-      REG_EQUIV [bx:DI]
-   11: [ax:DI]=dx:DI
+   11: [ax:DI]=bp:DI
    12: [bx:DI]=ax:DI
-   20: NOTE_INSN_EPILOGUE_BEG
-   21: bx:DI=[sp:DI++]
+   22: NOTE_INSN_EPILOGUE_BEG
+   23: {sp:DI=sp:DI+0x8;clobber flags:CC;clobber [scratch];}
       REG_CFA_ADJUST_CFA sp:DI=sp:DI+0x8
-   22: simple_return
-   25: barrier
+   24: bx:DI=[sp:DI++]
+      REG_CFA_ADJUST_CFA sp:DI=sp:DI+0x8
+   25: bp:DI=[sp:DI++]
+      REG_CFA_ADJUST_CFA sp:DI=sp:DI+0x8
+   26: simple_return
+   29: barrier
    17: NOTE_INSN_DELETED

  parent reply	other threads:[~2022-10-14  7:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 14:54 [Bug tree-optimization/107250] New: " jmuizelaar at mozilla dot com
2022-10-13 16:04 ` [Bug tree-optimization/107250] " amonakov at gcc dot gnu.org
2022-10-14  7:37 ` rguenth at gcc dot gnu.org [this message]
2022-10-14  7:55 ` [Bug target/107250] " amonakov 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-107250-4-AkCzIStzx7@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: link
Be 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).