public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/50891] New: move2add_note_store fails to properly track register content
@ 2011-10-27 22:59 hjl.tools at gmail dot com
  2011-10-27 23:11 ` [Bug rtl-optimization/50891] " hjl.tools at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2011-10-27 22:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50891

             Bug #: 50891
           Summary: move2add_note_store fails to properly track register
                    content
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com


There are

(insn 18 323 318 2 (set (reg:DI 2 cx [orig:110 MEM[(c_char * {ref-all})&A.0]+8
] [110])
        (mem/s/u/c:DI (const:SI (plus:SI (symbol_ref:SI ("A.0.1724") [flags
0x2] <var_decl 0x7ffff1435460 A.0>)
                    (const_int 8 [0x8]))) [0 MEM[(c_char * {ref-all})&A.0]+8 S8
A64])) x.f90:7 62 {*movdi_internal_rex64}
     (expr_list:REG_EQUIV (mem/s/u/c:DI (const:SI (plus:SI (symbol_ref:SI
("A.0.1724") [flags 0x2] <var_decl 0x7ffff1435460 A.0>)
                    (const_int 8 [0x8]))) [0 MEM[(c_char * {ref-all})&A.0]+8 S8
A64])
        (nil)))
....
(insn 73 71 74 11 (set (reg:SI 2 cx [125])
        (const_int 16 [0x10])) x.f90:12 64 {*movsi_internal}
     (expr_list:REG_EQUAL (const_int 16 [0x10])
        (nil)))

For some reason, move2add_use_add2_insn replaces it with

(insn 73 71 74 11 (set (strict_low_part (reg:QI 2 cx)) 
        (const_int 16 [0x10])) x.f90:12 81 {*movstrictqi_1}
     (expr_list:REG_EQUAL (const_int 16 [0x10])
        (nil)))

The problem is the upper 48bits of CX isn't zero.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/50891] move2add_note_store fails to properly track register content
  2011-10-27 22:59 [Bug rtl-optimization/50891] New: move2add_note_store fails to properly track register content hjl.tools at gmail dot com
@ 2011-10-27 23:11 ` hjl.tools at gmail dot com
  2011-10-27 23:21 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2011-10-27 23:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50891

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2011-10-27 23:10:45 UTC ---
reload_cse_move2add treats

(insn 61 60 62 8 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 2 cx)
            (const_int 3 [0x3]))) x.f90:9 6 {*cmpsi_1}
     (nil))

(jump_insn 62 61 63 8 (set (pc) 
        (if_then_else (ne (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref 231) 
            (pc))) x.f90:9 589 {*jcc_1}
     (expr_list:REG_BR_PROB (const_int 1400 [0x578])
        (nil))
 -> 231) 

with

(gdb) call debug_rtx (implicit_set)
(set (reg:SI 2 cx)
    (const_int 3 [0x3]))
(gdb) 

at
2046              move2add_note_store (SET_DEST (implicit_set), implicit_set,
insn);

It is wrong.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/50891] move2add_note_store fails to properly track register content
  2011-10-27 22:59 [Bug rtl-optimization/50891] New: move2add_note_store fails to properly track register content hjl.tools at gmail dot com
  2011-10-27 23:11 ` [Bug rtl-optimization/50891] " hjl.tools at gmail dot com
@ 2011-10-27 23:21 ` hjl.tools at gmail dot com
  2011-10-28 21:20 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2011-10-27 23:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50891

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2011-10-27 23:20:47 UTC ---
Does this:

---
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 0e50d85..526015b 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -2039,6 +2039,10 @@ reload_cse_move2add (rtx first)
       allocation if possible.  */
         && SCALAR_INT_MODE_P (GET_MODE (XEXP (cnd, 0)))
         && hard_regno_nregs[REGNO (XEXP (cnd, 0))][GET_MODE (XEXP (cnd, 0))]
== 1
+        /* Use implicit set only if the new mode is wider than
+      the previous mode since register isn't really set.  */
+        && (GET_MODE_SIZE (GET_MODE (XEXP (cnd, 0)))
+       >= GET_MODE_SIZE (reg_mode[REGNO (XEXP (cnd, 0))]))
         && CONST_INT_P (XEXP (cnd, 1)))
       {
         rtx implicit_set =
---

make any senses?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/50891] move2add_note_store fails to properly track register content
  2011-10-27 22:59 [Bug rtl-optimization/50891] New: move2add_note_store fails to properly track register content hjl.tools at gmail dot com
  2011-10-27 23:11 ` [Bug rtl-optimization/50891] " hjl.tools at gmail dot com
  2011-10-27 23:21 ` hjl.tools at gmail dot com
@ 2011-10-28 21:20 ` hjl.tools at gmail dot com
  2021-09-13  5:56 ` pinskia at gcc dot gnu.org
  2021-09-13 11:40 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2011-10-28 21:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50891

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2011-10-28 21:20:09 UTC ---
We have

(set (reg:DI 2) (mem))
...
(set (reg:HI 2) (const_int))
...
(set (reg:SI 2) (const_int))

Since we don't if know

(set (reg:HI 2) (const_int))

will update the whole register, move2add_note_store should
stop if the new mode is narrower than the previous mode.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/50891] move2add_note_store fails to properly track register content
  2011-10-27 22:59 [Bug rtl-optimization/50891] New: move2add_note_store fails to properly track register content hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2011-10-28 21:20 ` hjl.tools at gmail dot com
@ 2021-09-13  5:56 ` pinskia at gcc dot gnu.org
  2021-09-13 11:40 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-13  5:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, was this solve by r0-123608-g7894bc6be052 ?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/50891] move2add_note_store fails to properly track register content
  2011-10-27 22:59 [Bug rtl-optimization/50891] New: move2add_note_store fails to properly track register content hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2021-09-13  5:56 ` pinskia at gcc dot gnu.org
@ 2021-09-13 11:40 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2021-09-13 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
Dup.

*** This bug has been marked as a duplicate of bug 56833 ***

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-13 11:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-27 22:59 [Bug rtl-optimization/50891] New: move2add_note_store fails to properly track register content hjl.tools at gmail dot com
2011-10-27 23:11 ` [Bug rtl-optimization/50891] " hjl.tools at gmail dot com
2011-10-27 23:21 ` hjl.tools at gmail dot com
2011-10-28 21:20 ` hjl.tools at gmail dot com
2021-09-13  5:56 ` pinskia at gcc dot gnu.org
2021-09-13 11:40 ` hjl.tools 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).