[Bug lto/56483] New: LTO issue with expanding GIMPLE_COND
ysrumyan at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Feb 28 14:41:00 GMT 2013
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.
More information about the Gcc-bugs
mailing list