From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: Remove mode argument from gen_rtx_SET
Date: Fri, 08 May 2015 10:32:00 -0000 [thread overview]
Message-ID: <554C90BE.5080105@lauterbach.com> (raw)
In-Reply-To: <87ioc4vct9.fsf@e105548-lin.cambridge.arm.com>
Am 2015-05-07 um 13:37 schrieb Richard Sandiford:
> One problem with the automatically-generated gen_rtx_FOO () macros
> is that they always have a mode parameter, even for codes like SET
> where the mode should always be VOIDmode. This inevitably leads to
> cases where a caller accidentally passes something other than VOIDmode.
> E.g. when expanding an SImode move, the temptation is to make everything
> SImode, even the SETs. This in turn can cause two instructions to appear
> different simply because their SETs have different modes, even though the
> SET_DEST and SET_SRC are identical.
>
> E.g. for gcc/testsuite/g++.dg/torture/pr34651.C on lm32-elf we have
> the following before jump2:
>
> (jump_insn 42 191 43 5 (set (pc)
> (if_then_else (eq:SI (reg:SI 13 r13 [orig:43 inHotKey$4+-3 ] [43])
> (const_int 0 [0]))
> (label_ref 53)
> (pc))) gcc/testsuite/g++.dg/torture/pr34651.C:22 22 {*beq}
> (expr_list:REG_DEAD (reg:SI 13 r13 [orig:43 inHotKey$4+-3 ] [43])
> (int_list:REG_BR_PROB 5000 (nil)))
> -> 53)
> (note 43 42 48 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
> (insn 48 43 47 6 (set (reg:SI 2 r2)
> (mem/u/c:SI (reg:SI 1 r1) [4 S4 A32])) gcc/testsuite/g++.dg/torture/pr34651.C:22 7 {movsi_insn}
> (expr_list:REG_DEAD (reg:SI 1 r1)
> (nil)))
> [...]
> (code_label 53 169 54 7 6 "" [1 uses])
> (note 54 53 12 7 [bb 7] NOTE_INSN_BASIC_BLOCK)
> (insn 12 54 57 7 (set:SI (reg/f:SI 2 r2 [orig:46 D.2050 ] [46])
> (mem/u/c:SI (reg:SI 1 r1) [4 S4 A32])) gcc/testsuite/g++.dg/torture/pr34651.C:22 7 {movsi_insn}
> (expr_list:REG_DEAD (reg:SI 1 r1)
> (expr_list:REG_EQUAL (symbol_ref/f:SI ("*.LC3") [flags 0x2] <var_decl # *.LC3>)
> (nil))))
>
> where insns 12 and 48 are identical except for the :SI on the SET.
> This difference prevents us from merging the heads of the two blocks;
> after removing it we replace the two loads with a single load before
> the branch.
>
> This patch removes the mode argument from gen_rtx_SET and updates
> all callers. I used a script to (try to) make sure that all callers
> really had been caught. I also built one target per CPU just in case.
> There were some changes in gcc.dg, g++.dg and gcc.c-torture assembly
> code for c6x-elf, lm32-elf and v850-elf, but all of them seemed to be
> code improvements from removing duplicated instructions. (Other ports
> also passed spurious modes but apparently not in a way that affects
> the tests I'd tried.) Also tested on x86_64-linux-gnu. OK to install?
>
> BTW, I've split the patch up into two, the last bit being a mechanical
> removal of modes. (I did it by hand though to try to keep things
> properly formatted.)
>
> Thanks,
> Richard
>
>
> gcc/
> * rtl.h (always_void_p): New function.
> * gengenrtl.c (always_void_p(: Likewise.
> (genmacro): Don't add a mode parameter to gen_rtx_foo if rtxes
> with code foo are always VOIDmode.
> * genemit.c (gen_exp): Update gen_rtx_foo calls accordingly.
> * builtins.c, caller-save.c, calls.c, cfgexpand.c, combine.c,
> compare-elim.c, config/aarch64/aarch64.c,
> config/aarch64/aarch64.md, config/alpha/alpha.c,
> config/alpha/alpha.md, config/arc/arc.c, config/arc/arc.md,
> config/arm/arm-fixed.md, config/arm/arm.c, config/arm/arm.md,
> config/arm/ldrdstrd.md, config/arm/thumb2.md, config/arm/vfp.md,
> config/avr/avr.c, config/bfin/bfin.c, config/c6x/c6x.c,
> config/c6x/c6x.md, config/cr16/cr16.c, config/cris/cris.c,
> config/cris/cris.md, config/darwin.c, config/epiphany/epiphany.c,
> config/epiphany/epiphany.md, config/fr30/fr30.c, config/frv/frv.c,
> config/frv/frv.md, config/h8300/h8300.c, config/i386/i386.c,
> config/i386/i386.md, config/i386/sse.md, config/ia64/ia64.c,
> config/ia64/vect.md, config/iq2000/iq2000.c,
> config/iq2000/iq2000.md, config/lm32/lm32.c, config/lm32/lm32.md,
> config/m32c/m32c.c, config/m32r/m32r.c, config/m68k/m68k.c,
> config/m68k/m68k.md, config/mcore/mcore.c, config/mcore/mcore.md,
> config/mep/mep.c, config/microblaze/microblaze.c,
> config/mips/mips.c, config/mips/mips.md, config/mmix/mmix.c,
> config/mn10300/mn10300.c, config/msp430/msp430.c,
> config/nds32/nds32-memory-manipulation.c, config/nds32/nds32.c,
> config/nds32/nds32.md, config/nios2/nios2.c, config/nvptx/nvptx.c,
> config/pa/pa.c, config/pa/pa.md, config/rl78/rl78.c,
> config/rs6000/altivec.md, config/rs6000/rs6000.c,
> config/rs6000/rs6000.md, config/rs6000/vector.md,
> config/rs6000/vsx.md, config/rx/rx.c, config/rx/rx.md,
> config/s390/s390.c, config/s390/s390.md, config/sh/sh.c,
> config/sh/sh.md, config/sh/sh_treg_combine.cc,
> config/sparc/sparc.c, config/sparc/sparc.md, config/spu/spu.c,
> config/spu/spu.md, config/stormy16/stormy16.c,
> config/tilegx/tilegx.c, config/tilegx/tilegx.md,
> config/tilepro/tilepro.c, config/tilepro/tilepro.md,
> config/v850/v850.c, config/v850/v850.md, config/vax/vax.c,
> config/visium/visium.c, config/xtensa/xtensa.c, cprop.c, dse.c,
> expr.c, gcse.c, ifcvt.c, ira.c, jump.c, lower-subreg.c,
> lra-constraints.c, lra-eliminations.c, lra.c, postreload.c, ree.c,
> reg-stack.c, reload.c, reload1.c, reorg.c, sel-sched.c,
> var-tracking.c: Update gen_rtx_SET calls accordingly.
>
Hi Richard,
this patch (r222882 is fine, r222883 fails) breaks bootstrap for me on
x86_64-linux-gnu:
libtool: compile:
/home/fsirl/BUILD/gcc-6.0.0-r222903/obj-x86_64-suse-linux/./gcc/xgcc
-B/home/fsirl/BUILD/gcc-6.0.0-r222903/obj-x86_64-suse-linux/./gcc/
-B/usr/x86_64-suse-linux/bin/ -B/
usr/x86_64-suse-linux/lib/ -isystem /usr/x86_64-suse-linux/include
-isystem /usr/x86_64-suse-linux/sys-include -DHAVE_CONFIG_H -I.
-I../../../../libmpx/mpxwrap -I.. -fcheck-pointer-bounds
-mmpx -fno-chkp-check-read -fno-chkp-check-write -fno-chkp-use-wrappers
-fPIC -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -funwind-tables
-fasynchronous-unwind-tables -U_FORTIFY_SOURCE -
c ../../../../libmpx/mpxwrap/mpx_wrappers.c -fPIC -DPIC -o
.libs/libmpxwrappers_la-mpx_wrappers.o
../../../../libmpx/mpxwrap/mpx_wrappers.c: In function
ââ¬Ë__mpx_wrapper_memmove.chkpââ¬â¢:
../../../../libmpx/mpxwrap/mpx_wrappers.c:160:1: error: unrecognizable insn:
}
^
(insn 175 174 176 15 (parallel [
(set (reg:BND64 175 [ __bound_tmp.21 ])
(unspec:BND64 [
(mem:DI (unspec:DI [
(reg/v/f:DI 158 [ s ])
(reg/f:DI 159 [ D.3339 ])
] UNSPEC_BNDLDX_ADDR) [0 S8 A8])
] UNSPEC_BNDLDX))
(use (mem:BLK (reg/v/f:DI 158 [ s ]) [0 A8]))
]) -1
(nil))
../../../../libmpx/mpxwrap/mpx_wrappers.c:160:1: internal compiler
error: in extract_insn, at recog.c:2341
0x982ee5 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
../../gcc/rtl-error.c:110
0x982f23 _fatal_insn_not_found(rtx_def const*, char const*, int, char
const*)
../../gcc/rtl-error.c:118
0x933b92 extract_insn(rtx_insn*)
../../gcc/recog.c:2341
0x6c09bf instantiate_virtual_regs_in_insn
../../gcc/function.c:1598
0x6c1273 instantiate_virtual_regs
../../gcc/function.c:1966
0x6c1304 execute
../../gcc/function.c:2015
Franz.
next prev parent reply other threads:[~2015-05-08 10:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-07 11:37 Richard Sandiford
2015-05-07 13:36 ` Jeff Law
2015-05-07 14:00 ` Richard Sandiford
2015-05-07 15:05 ` Jeff Law
2015-05-08 10:32 ` Franz Sirl [this message]
2015-05-08 11:58 ` Segher Boessenkool
2015-05-08 12:52 ` Franz Sirl
2015-05-08 14:03 ` Richard Sandiford
2015-05-08 16:43 ` DJ Delorie
2015-05-09 9:52 ` Richard Sandiford
2015-05-11 16:55 ` DJ Delorie
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=554C90BE.5080105@lauterbach.com \
--to=franz.sirl-kernel@lauterbach.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.sandiford@arm.com \
/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).