[llvm-bugs] [Bug 40545] New: [Statepoint] Statepoint lowering crashes with -O0 but not -On (n>=1)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 31 05:44:17 PST 2019


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

            Bug ID: 40545
           Summary: [Statepoint] Statepoint lowering crashes with -O0 but
                    not -On (n>=1)
           Product: new-bugs
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jh at jakehughes.uk
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

When given this simple IR:




define i64 addrspace(1)* @bar(i64 addrspace(1)* %x1) gc "statepoint-example" {
entry:
  ret i64 addrspace(1)* %x1
}

define i64 addrspace(1)* @foo(i64 addrspace(1)* %y1) gc "statepoint-example" {
entry:
  %0 = call i64 addrspace(1)* @bar(i64 addrspace(1)* %y1)
  ret i64 addrspace(1)* %0
}




I generate statepoint relocation sequences in IR using the command: 

opt -rewrite-statepoints-for-gc -S -o out.ll in.ll 

This creates the following IR with statepoint intrinsics: 



define i64 addrspace(1)* @bar(i64 addrspace(1)* %x1) gc "statepoint-example" {
entry:
  ret i64 addrspace(1)* %x1
}

define i64 addrspace(1)* @foo(i64 addrspace(1)* %y1) gc "statepoint-example" {
entry:
  %statepoint_token = call token (i64, i32, i64 addrspace(1)* (i64
addrspace(1)*)*, i32, i32, ...)
@llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64 2882400000, i32 0, i64
addrspace(1)* (i64 addrspace(1)*)* @bar, i32 1, i32 0, i64 addrspace(1)* %y1,
i32 0, i32 0, i64 addrspace(1)* %y1)
  %0 = call i64 addrspace(1)* @llvm.experimental.gc.result.p1i64(token
%statepoint_token)
  %y1.relocated = call coldcc i8 addrspace(1)*
@llvm.experimental.gc.relocate.p1i8(token %statepoint_token, i32 8, i32 8) ;
(%y1, %y1)
  %y1.relocated.casted = bitcast i8 addrspace(1)* %y1.relocated to i64
addrspace(1)*
  ret i64 addrspace(1)* %0
}

declare void @__tmp_use(...)

declare token @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64, i32, i64
addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...)

; Function Attrs: nounwind readonly
declare i64 addrspace(1)* @llvm.experimental.gc.result.p1i64(token) #0

; Function Attrs: nounwind readonly
declare i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token, i32, i32)
#0

attributes #0 = { nounwind readonly }



When I try to compile this with llc -O0, this crashes with the error: 

LLVM ERROR: Cannot select: 0x558477a567e0: i64 = any_extend 0x558477a56778
In function: foo


Compilation is successful, however, if I use the default optimisation level,
-O2. I have also tested this with -O1 and -O3, both of which successfully
compile.

-- 
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/20190131/41e959dc/attachment-0001.html>


More information about the llvm-bugs mailing list