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

--- Comment #10 from Tom de Vries <vries at gcc dot gnu.org> ---
A good thing to note at this point: why doesn't init-regs work here?

The pass works per insn, and when hitting the insn with the problematic use:
...
(gdb) call debug_rtx (insn)
(insn 18 17 19 4 (set (reg/v:SI 30 [ c ])
        (reg/v:SI 26 [ d ])) 6 {*movsi_insn}
     (expr_list:REG_DEAD (reg/v:SI 26 [ d ])
        (nil)))
...
and dealing with the use of reg 26 we test:
...
              /* A use is MUST uninitialized if it reaches the top of           
                 the block from the inside of the block (the lr test)           
                 and no def for it reaches the top of the block from            
                 outside of the block (the ur test).  */
              if (bitmap_bit_p (lr, regno)
                  && (!bitmap_bit_p (ur, regno)))
...
where:
...
      bitmap lr = DF_LR_IN (bb);
      bitmap ur = DF_LIVE_IN (bb);
...

But we have:
...
(gdb) p bitmap_bit_p (lr, regno)
$1 = true
(gdb) p bitmap_bit_p (ur, regno)
$2 = true
...
so the test fails.

In terms of the rtl-dump, the insn is here:
...
(code_label 43 42 17 4 4 (nil) [1 uses])
(note 17 43 18 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(insn 18 17 19 4 (set (reg/v:SI 30 [ c ])
        (reg/v:SI 26 [ d ])) 6 {*movsi_insn}
     (expr_list:REG_DEAD (reg/v:SI 26 [ d ])
        (nil)))
...
and the corresponding df info is:
...
( 7 3 )->[4]->( 8 5 )
;; bb 4 artificial_defs: { }
;; bb 4 artificial_uses: { u-1(1){ }u-1(2){ }u-1(3){ }}
;; lr  in        1 [%stack] 2 [%frame] 3 [%args] 25 26 31 32 52
;; lr  use       1 [%stack] 2 [%frame] 3 [%args] 25 26
;; lr  def       26 30 38
;; live  in      1 [%stack] 2 [%frame] 3 [%args] 25 26 31 32 52
;; live  gen     26 30 38
;; live  kill
;; lr  out       1 [%stack] 2 [%frame] 3 [%args] 25 26 30 31 32 52
;; live  out     1 [%stack] 2 [%frame] 3 [%args] 25 26 30 31 32 52
...

In short, init-regs doesn't work for this example, because reg 26 is defined on
some incoming path, and ptx (or the JIT implementation) needs it to be defined
on all incoming paths.

Reply via email to