<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [Statepoint-VRegs] Dropped tied operand when folding unrelated memop"
   href="https://bugs.llvm.org/show_bug.cgi?id=46916">46916</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Statepoint-VRegs] Dropped tied operand when folding unrelated memop
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>listmail@philipreames.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Found while working on something else, full test case copied below.  Note that
after peephole-opt the def/use tied pairs have been broken.  This is a
miscompile.  

>From some quick digging, it appears to be a problem in foldPatchpoint in
lib/CodeGen/TargetInstInfo.cpp.  What appears to be happening is we're folding
a load into a deopt operand and not preserving the tied operand information
when building the new instruction.  Note that this *isn't* related to folding
gc operands themselves.


; RUN: llc -max-registers-for-gc-values=5
-stop-after=fixup-statepoint-caller-saved < %s

target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

declare void @foo()
declare void @consume(i8 addrspace(1)*)

define void @test(i8 addrspace(1)* %a, i8 addrspace(1)* %b, i8 addrspace(1)*
%c, i8 addrspace(1)* %d, i8 addrspace(1)* %e, i8 addrspace(1)* %f, i8
addrspace(1)* %g, i8 addrspace(1)* %h) gc "statepoint-example" {
entry:
  %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...)
@llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32
0, i32 0, i32 0, i32 0) ["gc-live" (i8 addrspace(1)* %a, i8 addrspace(1)* %b,
i8 addrspace(1)* %c, i8 addrspace(1)* %d, i8 addrspace(1)* %e, i8 addrspace(1)*
%f, i8 addrspace(1)* %g, i8 addrspace(1)* %h)]
  %a1 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token
%safepoint_token,  i32 0, i32 0)
  call void @consume(i8 addrspace(1)* %a1)
  %b1 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token
%safepoint_token,  i32 1, i32 1)
  call void @consume(i8 addrspace(1)* %b1)
  %c1 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token
%safepoint_token,  i32 2, i32 2)
  call void @consume(i8 addrspace(1)* %c1)
  %d1 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token
%safepoint_token,  i32 3, i32 3)
  call void @consume(i8 addrspace(1)* %c1)
  %e1 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token
%safepoint_token,  i32 4, i32 4)
  call void @consume(i8 addrspace(1)* %e1)
  %f1 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token
%safepoint_token,  i32 5, i32 5)
  call void @consume(i8 addrspace(1)* %f1)
  %g1 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token
%safepoint_token,  i32 6, i32 6)
  call void @consume(i8 addrspace(1)* %g1)
  %h1 = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token
%safepoint_token,  i32 7, i32 7)
  call void @consume(i8 addrspace(1)* %h1)
  ret void
}

declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32,
i32, ...)
declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*,
i32, i32, ...)
declare i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token, i32, i32)</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>