This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/41813] [4.5 Regression] SH: delay slot is filled with a wrong insn
- From: "kkojima at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Oct 2009 00:48:15 -0000
- Subject: [Bug target/41813] [4.5 Regression] SH: delay slot is filled with a wrong insn
- References: <bug-41813-5208@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from kkojima at gcc dot gnu dot org 2009-10-24 00:48 -------
For a slightly reduced case, the insns before dbr pass are
configured like as:
(insn 460 456 461
(parallel [(set (reg:SI 147 t)
(eq:SI (reg:DF 68 fr4) (reg:DF 66 fr2)))
(use (reg/v:PSI 151 ))]) {cmpeqdf_t})
(jump_insn 461 460 575
(set (pc) (if_then_else (eq (reg:SI 147 t) (const_int 0))
(label_ref:SI 571) (pc))) {branch_false})
(insn 575 461 576
(parallel [(set (pc) (unspec [(const_int 200) (pc)] 4))
(set (reg:SI 147 t) (const_int 1 [0x1]))]) {stuff_delay_slot})
(insn 576 575 572
(set (pc) (unspec [(const_int 200)] 4)))
(jump_insn 572 576 573
(set (pc) (label_ref 200)))
...
(code_label 200 198 263 25 "" [1 uses])
(note 263 200 202 [bb 20] NOTE_INSN_BASIC_BLOCK)
(insn 202 263 203
(set (reg:QI 2 r2) (reg:QI 147 t)) {movqi_i})
...
(code_label 571 573 501 85 "" [1 uses])
(note 501 571 502 [bb 32] NOTE_INSN_BASIC_BLOCK)
(jump_insn 502 501 503
(set (pc) (label_ref 471)) {jump_compact})
...
(code_label 471 497 262 53 "" [2 uses])
(note 262 471 199 [bb 29] NOTE_INSN_BASIC_BLOCK)
(insn 199 262 449
(parallel [(set (reg:SI 147 t)
(gt:SI (reg:DF 68 fr4) (reg:DF 66 fr2)))
(use (reg/v:PSI 151 ))]) {cmpgtdf_t})
and fill_slots_from_thread takes insn 199 as an insn
filling the delay slot of jump_insn 461. When this is done,
the opposite thread is started with stuff_delay_slot having
(set (reg T_REG) (const_int 1)) sub-pattern which makes
the live register analysis consider T_REG is defined here.
Thus fill_slots_from_thread takes insn 199 which changes
T_REG in spite of insn 202 in the opposite thread which
expects the original T_REG value. It seems that the pattern
(set (reg T_REG) ... in stuff_delay_slot insn is the cause
of this problem and stuff_delay_slot is simply used as
a unique marker. I'm testing the patch below.
--- ORIG/trunk/gcc/config/sh/sh.md 2009-08-13 09:46:10.000000000 +0900
+++ trunk/gcc/config/sh/sh.md 2009-10-23 17:07:19.000000000 +0900
@@ -6825,7 +6825,7 @@ label:
(define_insn "stuff_delay_slot"
[(set (pc)
(unspec [(match_operand:SI 0 "const_int_operand" "") (pc)] UNSPEC_BBR))
- (set (reg:SI T_REG) (match_operand:SI 1 "const_int_operand" ""))]
+ (match_operand:SI 1 "const_int_operand" "")]
"TARGET_SH1"
""
[(set_attr "length" "0")
--
kkojima at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41813