<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Kill flags missing on function argument copies"
   href="http://llvm.org/bugs/show_bug.cgi?id=19224">19224</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Kill flags missing on function argument copies
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kmod@dropbox.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12267" name="attach_12267" title="test case; run with "llc -o /dev/null -print-machineinstrs"">attachment 12267</a> <a href="attachment.cgi?id=12267&action=edit" title="test case; run with "llc -o /dev/null -print-machineinstrs"">[details]</a></span>
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
arguments.

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>,
%RSP<imp-def>
    %RDI<def> = MOV64rr %RBX<kill>
    CALL64pcrel32 <ga:@foo>, <regmask>, %RSP<imp-use>, %RDI<imp-use>,
%RSP<imp-def>
    %RBX<def> = POP64r %RSP<imp-def>, %RSP<imp-use>
    RETQ


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

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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>