[PATCH] Do not remove labels with LABEL_PRESERVE_P

Ilya Enkovich enkovich.gnu@gmail.com
Wed Sep 24 12:51:00 GMT 2014


2014-09-24 16:47 GMT+04:00 Steven Bosscher <stevenb.gcc@gmail.com>:
> On Wed, Sep 24, 2014 at 2:30 PM, Ilya Enkovich wrote:
>> I didn't generate references separately from label.  Now I found an
>> old patch and a test where this problem appeared.  In this patch I
>> moved set_rip generation currently performed in ix86_expand_prologue
>> into expand pass.  And I got following code in expand dump for
>> testsuite/gcc.target/i386/pr55154.c test:
>>
>> (note 7 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
>> (note/s 2 7 3 2 "" NOTE_INSN_DELETED_LABEL 2)
>> (insn 3 2 4 2 (set (reg:DI 85)
>>         (unspec:DI [
>>                 (label_ref [2 deleted])
>>             ] UNSPEC_SET_RIP))
>> /export/users/ienkovic/issues/4161/gcc/gcc/testsuite/gcc.target/i386/pr55154.c:9
>> -1
>>      (insn_list:REG_LABEL_OPERAND 2 (nil)))
>>
>> There is a REG_LABEL_OPERAND generated but label is still removed.
>
> Because it should be a REG_LABEL_TARGET?
>
> AFAUI this is a contol flow insn so I'd expect it to be a jump_insn
> (and the note will be a TARGET note). But it's not a PC-set insn and a
> jump target the compiler will interpret as an infinite loop (if the
> insns are really in the order as above) which is clearly not what you
> want. So if you emit it as a jump_insn I'm not sure what will
> happen...
>
> Is it necessary to emit the label into a basic block?

It is not a control flow instruction. It copies value of instruction
pointer into a general purpose register.  Therefore REG_LABEL_OPERAND
seems to be correct.

Ilya

>
> Ciao!
> Steven



More information about the Gcc-patches mailing list