public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/64037] Miscompilation with LTO and enum class : char parameter
Date: Mon, 24 Nov 2014 19:25:00 -0000	[thread overview]
Message-ID: <bug-64037-4-P0YXqEMpwx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64037-4@http.gcc.gnu.org/bugzilla/>

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |rtl-optimization
   Target Milestone|---                         |4.9.3

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
On x86, we don't require promoting QI/HI argument to SI.
Depending on optimization choice, we may generate SI move
for QI argument:

    movl    $2, %ecx    # 9    *movqi_internal/2    [length = 5]

For -Os, we generate:

    movb    $2, %cl    # 9    *movqi_internal/2    [length = 2]

since movb is shorter.  It is a pure luck that it only fails with -Os.
The combine pass turns

(insn 2 7 4 2 (set (reg/v/f:SI 88 [ out ])
        (reg:SI 0 ax [ out ])) ../pr64037.ii:8 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 0 ax [ out ])
        (nil)))
(insn 4 2 6 2 (set (reg:SI 91 [ b ])
        (reg:SI 2 cx [ b ])) ../pr64037.ii:8 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 2 cx [ b ])
        (nil)))
(note 6 4 9 2 NOTE_INSN_FUNCTION_BEG)
(insn 9 6 10 2 (set (reg:SI 92 [ b ])
        (zero_extend:SI (subreg:QI (reg:SI 91 [ b ]) 0))) ../pr64037.ii:9 138
{*
zero_extendqisi2}
     (expr_list:REG_DEAD (reg:SI 91 [ b ])
        (nil)))
(insn 10 9 0 2 (set (mem:SI (reg/v/f:SI 88 [ out ]) [1 *out_4(D)+0 S4 A32])
        (reg:SI 92 [ b ])) ../pr64037.ii:9 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 92 [ b ])
        (expr_list:REG_DEAD (reg/v/f:SI 88 [ out ])
            (nil))))

into

(insn 2 7 4 2 (set (reg/v/f:SI 88 [ out ])
        (reg:SI 0 ax [ out ])) pr64037.ii:8 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 0 ax [ out ])
        (nil)))
(insn 4 2 6 2 (set (reg:SI 91 [ b ])
        (reg:SI 2 cx [ b ])) pr64037.ii:8 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 2 cx [ b ])
        (nil)))
(note 6 4 9 2 NOTE_INSN_FUNCTION_BEG)
(note 9 6 10 2 NOTE_INSN_DELETED)
(insn 10 9 0 2 (set (mem:SI (reg/v/f:SI 88 [ out ]) [1 *out_4(D)+0 S4 A32])
        (reg:SI 91 [ b ])) pr64037.ii:9 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 91 [ b ])
        (expr_list:REG_DEAD (reg/v/f:SI 88 [ out ])
            (nil))))

It is certainly wrong.


  parent reply	other threads:[~2014-11-24 19:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-23 23:07 [Bug c++/64037] New: " js at alien8 dot de
2014-11-23 23:08 ` [Bug c++/64037] " js at alien8 dot de
2014-11-23 23:08 ` js at alien8 dot de
2014-11-23 23:09 ` js at alien8 dot de
2014-11-23 23:15 ` [Bug target/64037] " pinskia at gcc dot gnu.org
2014-11-24 11:13 ` rguenth at gcc dot gnu.org
2014-11-24 17:48 ` hjl.tools at gmail dot com
2014-11-24 17:49 ` pinskia at gcc dot gnu.org
2014-11-24 19:25 ` hjl.tools at gmail dot com [this message]
2014-11-24 19:52 ` [Bug rtl-optimization/64037] " hjl.tools at gmail dot com
2014-11-24 21:33 ` hjl.tools at gmail dot com
2014-11-24 21:39 ` hjl.tools at gmail dot com
2014-11-24 21:40 ` hjl.tools at gmail dot com
2014-11-25 18:23 ` [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os " hjl.tools at gmail dot com
2014-11-28 15:28 ` hjl at gcc dot gnu.org
2014-11-28 15:32 ` [Bug rtl-optimization/64037] [4.8/4.9 " hjl.tools at gmail dot com
2014-12-05 11:48 ` hjl at gcc dot gnu.org
2014-12-05 12:03 ` hjl at gcc dot gnu.org
2014-12-05 12:07 ` hjl.tools at gmail dot com
2014-12-09 14:35 ` uros at gcc dot gnu.org
2014-12-09 14:41 ` uros at gcc dot gnu.org
2014-12-09 14:44 ` uros at gcc dot gnu.org
2014-12-09 14:48 ` [Bug rtl-optimization/64037] [4.8/4.9/5 " ubizjak at gmail dot com
2014-12-10 13:22 ` rguenth at gcc dot gnu.org
2014-12-14 16:04 ` hjl at gcc dot gnu.org
2014-12-14 16:07 ` hjl at gcc dot gnu.org
2014-12-15 16:01 ` hjl.tools at gmail dot com
2014-12-19 13:40 ` jakub at gcc dot gnu.org
2014-12-19 19:20 ` hjl at gcc dot gnu.org
2014-12-19 19:49 ` hjl.tools at gmail dot com

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-64037-4-P0YXqEMpwx@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).