[llvm-bugs] [Bug 46916] New: [Statepoint-VRegs] Dropped tied operand when folding unrelated memop

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 30 11:24:07 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46916

            Bug ID: 46916
           Summary: [Statepoint-VRegs] Dropped tied operand when folding
                    unrelated memop
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: listmail at philipreames.com
                CC: llvm-bugs at lists.llvm.org

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)

-- 
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/20200730/507c9992/attachment.html>


More information about the llvm-bugs mailing list