public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/55024] New: cse_process_notes_1/equiv_constant: missing mode check for hardware registers
@ 2012-10-22 15:21 aurelien.buhrig.gcc at gmail dot com
0 siblings, 0 replies; only message in thread
From: aurelien.buhrig.gcc at gmail dot com @ 2012-10-22 15:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55024
Bug #: 55024
Summary: cse_process_notes_1/equiv_constant: missing mode check
for hardware registers
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: aurelien.buhrig.gcc@gmail.com
Created attachment 28509
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28509
cse_process_notes_1/equiv_constant
It seems there is a bug in cse_process_notes_1 (gcc 4.6.3, but should occurs on
trunk), for a private backend. The testcase is pr27364.c, compiled with -Os.
In the following RTL, the hardware register (reg:HI r2), whose natural mode is
HImode, is set to 0, but when analysing the REG_EQUAL notes of the MULT
insn during CSE pass, the (reg:SI r2) is computed to be equivalent to
(const_int 0), which is wrong (the target is big endian).
(insn 51 9 52 3 (set (reg:HI 2 r2)
(const_int 0 [0])) gcc.c-torture/execute/pr27364.c:5 18 {*movhi1}
(expr_list:REG_DEAD (reg:HI 31)
(expr_list:REG_EQUAL (const_int 0 [0])
(nil))))
(insn 52 51 12 3 (set (reg:HI 3 r3 [orig:2+2 ] [2])
(reg/v:HI 20 [ number_of_digits_to_use ]))
gcc.c-torture/execute/pr27364.c:5 18 {*movhi1}
(expr_list:REG_DEAD (reg/v:HI 20 [ number_of_digits_to_use ])
(nil)))
(insn 12 52 13 3 (set (reg:SI 0 r0)
(const_int 3321928 [0x32b048]))
gcc.c-torture/execute/pr27364.c:5 19 {movsi}
(nil))
(insn 13 12 16 3 (parallel [
(set (reg:SI 0 r0)
(mult:SI (reg:SI 2 r2)
(reg:SI 0 r0)))
(clobber (reg:SI 2 r2))
]) gcc.c-torture/execute/pr27364.c:5 54 {*mulsi3_call}
(expr_list:REG_EQUAL (mult:SI (reg:SI 2 r2)
(const_int 3321928 [0x32b048]))
(expr_list:REG_DEAD (reg:HI 3 r3)
(expr_list:REG_UNUSED (reg:SI 2 r2)
(nil)))))
I think a mode size check is missing when processing REG code in
cse_process_notes_1. Adding such a check prevents the CSE pass from
elimintating the MULT instruction.
The attached patch fixes this issue.
I added the same check in equiv_constant as suggested by Eric Botcazou:
http://gcc.gnu.org/ml/gcc/2012-10/msg00263.html
Not yet bootstraped on trunk.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-10-22 15:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-22 15:21 [Bug middle-end/55024] New: cse_process_notes_1/equiv_constant: missing mode check for hardware registers aurelien.buhrig.gcc at gmail dot com
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).