public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/56483] New: LTO issue with expanding GIMPLE_COND
@ 2013-02-28 14:41 ysrumyan at gmail dot com
  2013-02-28 14:43 ` [Bug lto/56483] " ysrumyan at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ysrumyan at gmail dot com @ 2013-02-28 14:41 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56483
           Summary: LTO issue with expanding GIMPLE_COND
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ysrumyan@gmail.com


If we compile attached simple test-case with -flto and -fno-inline we can see
the following sequence of rtl produced for or-ed condition:

;; if (_5 != 0)

(insn 18 17 19 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:QI 59 [ c ])
            (const_int 45 [0x2d]))) t1.c:12 -1
     (nil))

(insn 19 18 20 (set (reg:QI 66 [ D.2371 ])
        (eq:QI (reg:CCZ 17 flags)
            (const_int 0 [0]))) t1.c:12 -1
     (nil))

(insn 20 19 21 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:QI 59 [ c ])
            (const_int 43 [0x2b]))) t1.c:12 -1
     (nil))

(insn 21 20 22 (set (reg:QI 68 [ D.2371 ])
        (eq:QI (reg:CCZ 17 flags)
            (const_int 0 [0]))) t1.c:12 -1
     (nil))

(insn 22 21 23 (parallel [
            (set (reg:QI 69 [ D.2371 ])
                (ior:QI (reg:QI 66 [ D.2371 ])
                    (reg:QI 68 [ D.2371 ])))
            (clobber (reg:CC 17 flags))
        ]) t1.c:12 -1
     (nil))

(insn 23 22 24 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:QI 69 [ D.2371 ])
            (const_int 0 [0]))) t1.c:12 -1
     (nil))

(jump_insn 24 23 0 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref 0)
            (pc))) t1.c:12 -1
     (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
        (nil)))
i.e. or-ed conditions were not ;; if (_5 != 0)

(insn 18 17 19 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:QI 59 [ c ])
            (const_int 45 [0x2d]))) t1.c:12 -1
     (nil))

(insn 19 18 20 (set (reg:QI 66 [ D.2371 ])
        (eq:QI (reg:CCZ 17 flags)
            (const_int 0 [0]))) t1.c:12 -1
     (nil))

(insn 20 19 21 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:QI 59 [ c ])
            (const_int 43 [0x2b]))) t1.c:12 -1
     (nil))

(insn 21 20 22 (set (reg:QI 68 [ D.2371 ])
        (eq:QI (reg:CCZ 17 flags)
            (const_int 0 [0]))) t1.c:12 -1
     (nil))

(insn 22 21 23 (parallel [
            (set (reg:QI 69 [ D.2371 ])
                (ior:QI (reg:QI 66 [ D.2371 ])
                    (reg:QI 68 [ D.2371 ])))
            (clobber (reg:CC 17 flags))
        ]) t1.c:12 -1
     (nil))

(insn 23 22 24 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:QI 69 [ D.2371 ])
            (const_int 0 [0]))) t1.c:12 -1
     (nil))

(jump_insn 24 23 0 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref 0)
            (pc))) t1.c:12 -1
     (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
        (nil)))
i.e. condition was not splitted.

The problem is in gimple_cond_single_var_p (stmt) which return false since 0
(or 1) is not presented as boolean_false_node (boolean_true_node) but if we
change 
e.g.
    gimple_cond_rhs (gs) == boolean_false_node
to
    integer_zerop (gimple_cond_rhs (gs))

required splitting will happen.
Another way is to fix IR reader in lto.


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

end of thread, other threads:[~2013-03-18 10:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-28 14:41 [Bug lto/56483] New: LTO issue with expanding GIMPLE_COND ysrumyan at gmail dot com
2013-02-28 14:43 ` [Bug lto/56483] " ysrumyan at gmail dot com
2013-03-01 11:00 ` [Bug middle-end/56483] " rguenth at gcc dot gnu.org
2013-03-01 11:03 ` rguenth at gcc dot gnu.org
2013-03-18 10:31 ` rguenth at gcc dot gnu.org
2013-03-18 10:31 ` rguenth at gcc dot gnu.org

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).