public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "terry.guo at arm dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64154] enable fipa-ra for Thumb1
Date: Thu, 08 Jan 2015 08:17:00 -0000	[thread overview]
Message-ID: <bug-64154-4-k0zjrxsAje@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64154-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Terry Guo <terry.guo at arm dot com> ---
Hi Tom,

I enabled this optimization to thumb1 target cortex-m0 and found this IPA-RA
optimization doesn't consider the register clobber information attached to call
rtx and thus generated bad code. Here are the bad rtxs I extracted from the
dump of cprop_hardreg pass:

(insn 292 291 141 13 (set (reg:SI 4 r4 [orig:163 ivtmp.108 ] [163])
        (reg:SI 12 ip [orig:163 ivtmp.108 ] [163])) 742 {*thumb1_movsi_insn}
     (expr_list:REG_DEAD (reg:SI 12 ip [orig:163 ivtmp.108 ] [163])
        (nil)))

(call_insn 141 292 142 13 (parallel [
            (call (mem:SI (symbol_ref:SI ("f2") [flags 0x3]  <function_decl
0x7f8182689100 f2>) [0 f2 S4 A32])
                (const_int 0 [0]))
            (use (const_int 0 [0]))
            (clobber (reg:SI 14 lr))
        ])
/myssd/terguo01/toolchain-build/GCC32RM-424/src/gcc/gcc/testsuite/gcc.dg/vshift-3.c:119
770 {*call_insn}
     (expr_list:REG_CALL_DECL (symbol_ref:SI ("f2") [flags 0x3]  <function_decl
0x7f8182689100 f2>)
        (expr_list:REG_EH_REGION (const_int 0 [0])
            (nil)))
    (expr_list (clobber (reg:SI 12 ip))
        (nil)))

(insn 11 10 12 13 (set (reg:SI 0 r0 [orig:170 ivtmp.130 ] [170])
        (reg:SI 12 ip [orig:163 ivtmp.108 ] [163]))
/myssd/terguo01/toolchain-build/GCC32RM-424/src/gcc/gcc/testsuite/gcc.dg/vshift-3.c:121
742 {*thumb1_movsi_insn}
     (expr_list:REG_EQUAL (symbol_ref:SI ("j") [flags 0x80]  <var_decl
0x7f81827d0750 j>)
        (nil)))

I checked the code in 'if (CALL_P (insn))' part in file regcprop.c and found
the algorithm doesn't consider the '(expr_list (clobber (reg:SI 12 ip))' in
insn 141 which makes current algorithm think it is safe to propagate ip from
insn 292 to insn 11.

The case is from gcc regression test and compiled with option "-mthumb
-mcpu=cortex-m0 -O3".


  parent reply	other threads:[~2015-01-08  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 17:17 [Bug target/64154] New: enable fuse-caller-save " vries at gcc dot gnu.org
2014-12-03 10:34 ` [Bug target/64154] enable fipa-ra " vries at gcc dot gnu.org
2014-12-12 14:59 ` ramana at gcc dot gnu.org
2015-01-08  8:17 ` terry.guo at arm dot com [this message]
2015-01-08 13:55 ` vries at gcc dot gnu.org
2015-01-08 14:18 ` vries at gcc dot gnu.org
2022-01-10  0:21 ` pinskia 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-64154-4-k0zjrxsAje@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).