This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/69416] [6 Regression] Nonsense rtl checking failure


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

--- Comment #2 from Wilco <wdijkstr at arm dot com> ---
Started looking at this- it looks like line 1833 in emit-rtl.c gets miscompiled
in combine:

(insn 397 389 394 38 (set (reg:SI 462)
        (const_int 29 [0x1d])) ./emit-rtl.c:1833 49 {*movsi_aarch64}
     (nil))
(insn 394 397 399 38 (set (reg:CC 66 cc)
        (compare:CC (reg:SI 1002 [ ref_309(D)->code ])
            (const_int 47 [0x2f]))) ./emit-rtl.c:1833 385 {cmpsi}
     (expr_list:REG_DEAD (reg:SI 1002 [ ref_309(D)->code ])
        (nil)))
(insn 399 394 400 38 (set (reg:CC 66 cc)
        (if_then_else:CC (ne (reg:CC 66 cc)
                (const_int 0 [0]))
            (compare:CC (reg:SI 462)
                (const_int 1 [0x1]))
            (const_int 8 [0x8]))) ./emit-rtl.c:1833 3 {ccmpsi}
     (expr_list:REG_DEAD (reg:SI 462)
        (nil)))
(insn 400 399 402 38 (set (reg:SI 465)
        (gtu:SI (reg:CC 66 cc)
            (const_int 0 [0]))) ./emit-rtl.c:1833 423 {aarch64_cstoresi}
     (expr_list:REG_DEAD (reg:CC 66 cc)
        (nil)))


Trying 397, 399 -> 400:
Successfully matched this instruction:
(set (reg:SI 465)
    (const_int 1 [0x1]))
(const_int 1 [0x1])

It doesn't list the substitution before simplification, but it should be:

(set (reg:SI 465)
  (gtu:SI 
      (if_then_else:CC (ne (reg:SI 1002 [ ref_309(D)->codeD.85066 ]) 
                           (const_int 47 [0x2f]))
        (compare:CC (const_int 29 [0x1d]) (const_int 1 [0x1]))
        (const_int 8 [0x8])))
      (const_int 0 [0])))

I don't see how it could simplify this unless it constant evaluates both the
then and else (despite CCmode type being special and needing extra care) and
decides they are both true, so the if-condition doesn't matter at all...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]