[LLVMbugs] [Bug 19224] New: Kill flags missing on function argument copies

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 21 14:53:00 PDT 2014


            Bug ID: 19224
           Summary: Kill flags missing on function argument copies
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: kmod at dropbox.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12267
  --> http://llvm.org/bugs/attachment.cgi?id=12267&action=edit
test case; run with "llc -o /dev/null -print-machineinstrs"

It seems like the liveness analyzer removes kill flags from all register uses,
expecting them to be added back later, but they don't get re-added to registers
that start off as physical registers due to ABI constraints, such as function

I'm not sure what the scope of this is, but it means that the later analyses
will be overly-conservative about the set of live-ins and live-outs, since they
may not consider the function arguments dead even when they are.

For example, with this IR:

declare void @foo(i64)

define void @test(i64 %a) {
  call void @foo(i64 1)
  call void @foo(i64 %a)
  ret void

The following machine instructions are generated:

BB#0: derived from LLVM BB %0
    Live Ins: %RDI %RBX
    PUSH64r %RBX<kill>, %RSP<imp-def>, %RSP<imp-use>; flags: FrameSetup
    PROLOG_LABEL <MCSym=.Ltmp0>
    PROLOG_LABEL <MCSym=.Ltmp1>
    %RBX<def> = MOV64rr %RDI
    %EDI<def,dead> = MOV32ri64 1, %RDI<imp-def>
    CALL64pcrel32 <ga:@foo>, <regmask>, %RSP<imp-use>, %RDI<imp-use>,
    %RDI<def> = MOV64rr %RBX<kill>
    CALL64pcrel32 <ga:@foo>, <regmask>, %RSP<imp-use>, %RDI<imp-use>,
    %RBX<def> = POP64r %RSP<imp-def>, %RSP<imp-use>

Notice that there is no kill flag on the "%RBX<def> = MOV64rr %RDI"

I may be misunderstanding whether or not the kill flag is warranted here, but
in that case I think other parts of the code do as well.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140321/5a0fe10b/attachment.html>

More information about the llvm-bugs mailing list