Call instruction

My home e--mail is down, which is where I get my llvm feeds, so please copy
any replies to this address as well as the list.

The call instruction can define implicit defs. What are the semantics when
the call includes a use with a kill of some register and also an implicit def
of that register? Is the register to be considered live out at that point?

I've found a failing testcase where register scavenging complains about
redefining a live register. The (ARM) code looks like this:

bb408: 0x9b07468, LLVM BB @0x9ae9010, ID#8:
Live Ins: %r4 %r5 %r7
    Predecessors according to CFG: 0x9b08398 (#71)
  STR %r4<kill>, %sp, %NOREG, 0, 14, %NOREG
  %r4 = MOVi 0, 14, %NOREG, %NOREG
  %r0 = MOVr %r7<kill>, 14, %NOREG, %NOREG
  %r1 = MOVr %r5<kill>, 14, %NOREG, %NOREG
  %r2 = LDR <fi#1>, %NOREG, 0, 14, %NOREG
  %r3 = MOVr %r4, 14, %NOREG, %NOREG
  BL <ga:gimplify_cond_expr>, %r0<kill>, %r1<kill>, %r2<kill>, %r3<kill>,
%r0<imp-def>, %r1<imp-def,dead>, %r2<imp-def,dead>, %r3<imp-def,dead>,
%r12<imp-def,dead>, %lr<imp-def,dead>, %d0<imp-def,dead>, %d1<imp-def,dead>,
%d2<imp-def,dead>, %d3<imp-def,dead>, %d4<imp-def,dead>, %d5<imp-def,dead>,
%d6<imp-def,dead>, %d7<imp-def,dead>, %cpsr<imp-def,dead>
  %r0 = MOVr %r4<kill>, 14, %NOREG, %NOREG
  %sp = ADDri %sp<kill>, 12, 14, %NOREG, %NOREG
  %r4 = LDR <fi#10>, %NOREG, 0, 14, %NOREG
  %r5 = LDR <fi#9>, %NOREG, 0, 14, %NOREG
  %r6 = LDR <fi#8>, %NOREG, 0, 14, %NOREG
  %r7 = LDR <fi#7>, %NOREG, 0, 14, %NOREG
  %r8 = LDR <fi#6>, %NOREG, 0, 14, %NOREG
  %r9 = LDR <fi#5>, %NOREG, 0, 14, %NOREG
  %r10 = LDR <fi#4>, %NOREG, 0, 14, %NOREG
  %r11 = LDR <fi#3>, %NOREG, 0, 14, %NOREG
  %lr = LDR <fi#2>, %NOREG, 0, 14, %NOREG
  %sp = ADDri %sp<kill>, 36, 14, %NOREG, %NOREG
  BX_RET 14, %NOREG, %r0<imp-use,kill>

The problem is the def of %r0 right after the BL. %r0 is killed at the BL but
is also implicitly defed and not marked dead. I believe it should be marked
dead at the implicit def, similarly to %r1. Is that right?

This is probably a bug I introduced but I want to make sure it actually is a
bug.

                                                             -Dave

My home e--mail is down, which is where I get my llvm feeds, so please copy
any replies to this address as well as the list.

The call instruction can define implicit defs. What are the semantics when
the call includes a use with a kill of some register and also an implicit def
of that register? Is the register to be considered live out at that point?

Right. The register should be considered live past the call instruction.

I've found a failing testcase where register scavenging complains about
redefining a live register. The (ARM) code looks like this:

bb408: 0x9b07468, LLVM BB @0x9ae9010, ID#8:
Live Ins: %r4 %r5 %r7
    Predecessors according to CFG: 0x9b08398 (#71)
  STR %r4<kill>, %sp, %NOREG, 0, 14, %NOREG
  %r4 = MOVi 0, 14, %NOREG, %NOREG
  %r0 = MOVr %r7<kill>, 14, %NOREG, %NOREG
  %r1 = MOVr %r5<kill>, 14, %NOREG, %NOREG
  %r2 = LDR <fi#1>, %NOREG, 0, 14, %NOREG
  %r3 = MOVr %r4, 14, %NOREG, %NOREG
  BL <ga:gimplify_cond_expr>, %r0<kill>, %r1<kill>, %r2<kill>, %r3<kill>,
%r0<imp-def>, %r1<imp-def,dead>, %r2<imp-def,dead>, %r3<imp-def,dead>,
%r12<imp-def,dead>, %lr<imp-def,dead>, %d0<imp-def,dead>, %d1<imp-def,dead>,
%d2<imp-def,dead>, %d3<imp-def,dead>, %d4<imp-def,dead>, %d5<imp-def,dead>,
%d6<imp-def,dead>, %d7<imp-def,dead>, %cpsr<imp-def,dead>
  %r0 = MOVr %r4<kill>, 14, %NOREG, %NOREG
  %sp = ADDri %sp<kill>, 12, 14, %NOREG, %NOREG
  %r4 = LDR <fi#10>, %NOREG, 0, 14, %NOREG
  %r5 = LDR <fi#9>, %NOREG, 0, 14, %NOREG
  %r6 = LDR <fi#8>, %NOREG, 0, 14, %NOREG
  %r7 = LDR <fi#7>, %NOREG, 0, 14, %NOREG
  %r8 = LDR <fi#6>, %NOREG, 0, 14, %NOREG
  %r9 = LDR <fi#5>, %NOREG, 0, 14, %NOREG
  %r10 = LDR <fi#4>, %NOREG, 0, 14, %NOREG
  %r11 = LDR <fi#3>, %NOREG, 0, 14, %NOREG
  %lr = LDR <fi#2>, %NOREG, 0, 14, %NOREG
  %sp = ADDri %sp<kill>, 36, 14, %NOREG, %NOREG
  BX_RET 14, %NOREG, %r0<imp-use,kill>

The problem is the def of %r0 right after the BL. %r0 is killed at the BL but
is also implicitly defed and not marked dead. I believe it should be marked
dead at the implicit def, similarly to %r1. Is that right?

Right. %r0 imp-def should be marked dead.

Evan