Hello,

While testing PR 58960 on ia64, I've enabled selective scheduling for bootstrap and found two small issues. One is the other instance of PR 57662 and another one is a miscompile that happens because we emit an insn with INSN_DELETED_P flag set; the insn then obviously does not get output in the assembly file. The reason for this is that we've cached this insn in the transformation cache and reused it after it was deleted from the insn stream. The patch resetting the flag qualifies as obvious, but I've discussed it additionally with Alexander, and will be committing it shortly. (The bootstrap fail is actually a regression, also I don't see how to make a (small) test case.)

Steven, we've been adding insns through add_insn_after and since you've touched the code last, I wanted to ask you two things. First, do you want an assert there that we do not add INSN_DELETED_P insns (like we have for the "after" parameter in add_insn_after_nobb?) I have added one and it didn't fail on the x86-64 bootstrap, which is no wonder since this one is directly used by reorg and sel-sched only. Second, the comment for add_insn_after about the BB parameter does not apply -- the code immediately does

3871 void
3872 add_insn_after (rtx insn, rtx after, basic_block bb)
3873 {
3874   add_insn_after_nobb (insn, after);
3875   if (!BARRIER_P (after)
3876       && !BARRIER_P (insn)
3877       && (bb = BLOCK_FOR_INSN (after)))

so the bb parameter gets overwritten. Should that be fixed in line with add_insn_before code?

Yours,
Andrey

2013-01-31  Andrey Belevantsev  <a...@ispras.ru>

* sel-sched-ir.c (sel_gen_insn_from_expr_after): Reset INSN_DELETED_P on the insn being emitted.
Index: sel-sched-ir.c
===================================================================
*** sel-sched-ir.c	(revision 207299)
--- sel-sched-ir.c	(working copy)
*************** sel_gen_insn_from_expr_after (expr_t exp
*** 1398,1403 ****
--- 1398,1408 ----
    emit_expr = set_insn_init (expr, vinsn ? vinsn : EXPR_VINSN (expr),
                               seqno);
    insn = EXPR_INSN_RTX (emit_expr);
+ 
+   /* The insn may come from the transformation cache, which may hold already
+      deleted insns, so mark it as not deleted.  */
+   INSN_DELETED_P (insn) = 0;
+ 
    add_insn_after (insn, after, BLOCK_FOR_INSN (insn));
  
    flags = INSN_INIT_TODO_SSID;

Reply via email to