Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[AMDGPU] shader generated by radeonsi crashes LLVM codegen #38187

Open Quuxplusone opened 6 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR39214
Status NEW
Importance P normal
Reported by Józef Kucia (joseph.kucia@gmail.com)
Reported on 2018-10-08 01:56:50 -0700
Last modified on 2018-10-08 07:08:21 -0700
Version 6.0
Hardware PC Linux
CC llvm-bugs@lists.llvm.org, Matthew.Arsenault@amd.com
Fixed by commit(s)
Attachments llvm-code.bc (3256 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 20976
bitcode

The attached LLVM bitcode is prodcued by radeonsi.

LLVM 7.0.0:

--- snip ---
LLVM ERROR: Cannot select: 0x55bf333f40c0: v4i32,ch = load<(dereferenceable
invariant load 16 from %ir.25, addrspace 2)> 0x55bf33367b28, 0x55bf333f9438,
undef:i32
  0x55bf333f9438: i32 = add 0x55bf333f94a0, Constant:i32<272>
    0x55bf333f94a0: i32,ch = CopyFromReg 0x55bf33367b28, Register:i32 %42
      0x55bf333f98b0: i32 = Register %42
    0x55bf333f9710: i32 = Constant<272>
  0x55bf333f4128: i32 = undef
In function: main
--- snip ---

LLVM 6.0.1:

--- snip ---
#0 0x00007fd358284daa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib64/llvm/6/bin/../lib64/libLLVMSupport.so.6+0x108daa)
#1 0x00007fd358282c96 llvm::sys::RunSignalHandlers()
(/usr/lib64/llvm/6/bin/../lib64/libLLVMSupport.so.6+0x106c96)
#2 0x00007fd358282f1b
(/usr/lib64/llvm/6/bin/../lib64/libLLVMSupport.so.6+0x106f1b)
#3 0x00007fd35717cfe0 (/lib64/libc.so.6+0x35fe0)
#4 0x00007fd359ca34e1
(/usr/lib64/llvm/6/bin/../lib64/libLLVMCodeGen.so.6+0x2fb4e1)
Stack dump:
0.  Program arguments: /usr/lib/llvm/6/bin/llc llvm-code.bc
1.  Running pass 'CallGraph Pass Manager' on module 'llvm-code.bc'.
2.  Running pass 'Simple Register Coalescing' on function '@main'
Segmentation fault
--- snip ---
Quuxplusone commented 6 years ago

Attached llvm-code.bc (3256 bytes, application/octet-stream): bitcode

Quuxplusone commented 6 years ago

How was this bitcode produced? This is using the old address space mapping, which shouldn't work anymore with a recent version

Quuxplusone commented 6 years ago

If I update the constant address space number to 4, this compiles for me on trunk

Quuxplusone commented 6 years ago

It was produced by radeonsi compiled with LLVM 6. You're right it works correctly when radeonsi is compiled with LLVM 7. The bug is present only in LLVM 6. Sorry for wasting your time.