[llvm-dev] What does a dead register mean?

Bhatu via llvm-dev
Tue, 06 Feb 2018 05:14:02 -0000

Hi,

My understanding of a "dead" register is a def that is never used.
However,
when I dump the MI after reg alloc on a simple program I see the following
sequence:

ADJCALLSTACKDOWN64 0, 0, 0, *implicit-def dead %rsp*, implicit-def dead
%eflags, implicit-def dead %ssp, implicit %rsp, implicit %ssp
CALL64pcrel32 @foo, <regmask %bh %bl %bp %bpl %bx %ebp %ebx %rbp %rbx %r12
%r13 %r14 %r15 %r12b %r13b %r14b %r15b %r12d %r13d %r14d %r15d %r12w %r13w
%r14w %r15w>, *implicit %rsp*, implicit %ssp, implicit-def %rsp,
implicit-def %ssp
ADJCALLSTACKUP64 0, 0, implicit-def dead %rsp, implicit-def dead %eflags,
implicit-def dead %ssp, implicit %rsp, implicit %ssp
RET 0


The ADJCALLSTACKDOWN64 has implicit-def dead %rsp. However the next
instruction,
CALL64pcrel32 has an implicit use of %rsp. This would be a use of %rsp as
defined
in ADJCALLSTACKDOWN64 making that non-dead.

So I guess my understanding of dead is incorrect. Could you please explain
what dead means?


For reference:
Source file(a.c):
void foo(void);
void boo(){ foo(); }

Commands:
clang -S -emit-llvm -Xclang -disable-O0-optnone a.c
llc -print-after="stack-slot-coloring" a.ll

--
Regards
Bhatu
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180206/22946cd3/attachment.html>