LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 23312 - [Backend: R600] UNREACHABLE executed at lib/Target/R600/AMDGPUInstrInfo.cpp:97!
Summary: [Backend: R600] UNREACHABLE executed at lib/Target/R600/AMDGPUInstrInfo.cpp:97!
Status: RESOLVED WONTFIX
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-22 07:38 PDT by Chilledheart
Modified: 2016-03-07 10:18 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments
getelementptr.ll (1.65 KB, application/octet-stream)
2015-04-22 07:38 PDT, Chilledheart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chilledheart 2015-04-22 07:38:47 PDT
Created attachment 14239 [details]
getelementptr.ll

The testcase in platform-independent fix rL231984 reveals possible issues with R600 backend.

The below lines are identical to test/CodeGen/X86/getelementptr.ll

; RUN: llc < %s -O0 -march=r600
; RUN: llc < %s -O2 -march=r600

define i8* @test_trunc65(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc65
; CHECK: 3
  %d = getelementptr i8, i8* %ptr, i65 18446744073709551619 ; 2^64 + 3
  ret i8* %d
}

define i8* @test_trunc128(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc128
; CHECK: 5
  %d = getelementptr i8, i8* %ptr, i128 18446744073709551621 ; 2^64 + 5
  ret i8* %d
}

define i8* @test_trunc160(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc160
; CHECK: 8
  %d = getelementptr i8, i8* %ptr, i160 18446744073709551624 ; 2^64 + 8
  ret i8* %d
}

define i8* @test_trunc256(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc256
; CHECK: 13
  %d = getelementptr i8, i8* %ptr, i256 18446744073709551629 ; 2^64 + 13
  ret i8* %d
}

define i8* @test_trunc2048(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc2048
; CHECK: 21
  %d = getelementptr i8, i8* %ptr, i2048 18446744073709551637 ; 2^64 + 21
  ret i8* %d
}


; Test small index sext to pointer size

define i8* @test_sext3(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext3
; CHECK: -3
  %d = getelementptr i8, i8* %ptr, i3 -3
  ret i8* %d
}

define i8* @test_sext5(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext5
; CHECK: -5
  %d = getelementptr i8, i8* %ptr, i5 -5
  ret i8* %d
}

define i8* @test_sext8(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext8
; CHECK: -8
  %d = getelementptr i8, i8* %ptr, i8 -8
  ret i8* %d
}

define i8* @test_sext13(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext13
; CHECK: -13
  %d = getelementptr i8, i8* %ptr, i8 -13
  ret i8* %d
}

define i8* @test_sext16(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext16
; CHECK: -21
  %d = getelementptr i8, i8* %ptr, i8 -21
  ret i8* %d
}

backtrace:
$llc -O0 -march=r600 

Not Implemented
UNREACHABLE executed at /home/ch/sources-llvm/llvm/lib/Target/R600/AMDGPUInstrInfo.cpp:97!
#0 0x1e6902e llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/ch/sources-llvm/llvm/lib/Support/Unix/Signals.inc:424:15
#1 0x1e69fa9 PrintStackTraceSignalHandler(void*) /home/ch/sources-llvm/llvm/lib/Support/Unix/Signals.inc:483:1
#2 0x1e6a483 SignalHandler(int) /home/ch/sources-llvm/llvm/lib/Support/Unix/Signals.inc:199:60
#3 0x7f6b0c99a8d0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0xf8d0)
#4 0x7f6b0bbda107 gsignal /build/glibc-Ir_s5K/glibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x7f6b0bbdb4e8 abort /build/glibc-Ir_s5K/glibc-2.19/stdlib/abort.c:91:0
#6 0x1e1b356 (/home/ch/build-debug/bin/llc+0x1e1b356)
#7 0xf081e8 /home/ch/sources-llvm/llvm/lib/Target/R600/AMDGPUInstrInfo.cpp:97:3
#8 0x168d423 (anonymous namespace)::RAFast::spillVirtReg(llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr, llvm::ilist_iterator<llvm::MachineInstr> >, (anonymous namespace)::RAFast::LiveReg*) /home/ch/sources-llvm/llvm/lib/CodeGen/RegAllocFast.cpp:290:5
#9 0x168b63b (anonymous namespace)::RAFast::spillAll(llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr, llvm::ilist_iterator<llvm::MachineInstr> >) /home/ch/sources-llvm/llvm/lib/CodeGen/RegAllocFast.cpp:334:16
#10 0x1689914 (anonymous namespace)::RAFast::AllocateBasicBlock() /home/ch/sources-llvm/llvm/lib/CodeGen/RegAllocFast.cpp:1067:3
#11 0x1687e50 (anonymous namespace)::RAFast::runOnMachineFunction(llvm::MachineFunction&) /home/ch/sources-llvm/llvm/lib/CodeGen/RegAllocFast.cpp:1103:5
#12 0x15e142e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/ch/sources-llvm/llvm/lib/CodeGen/MachineFunctionPass.cpp:40:3
#13 0x19bd31d llvm::FPPassManager::runOnFunction(llvm::Function&) /home/ch/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1538:23
#14 0x19bd628 llvm::FPPassManager::runOnModule(llvm::Module&) /home/ch/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1558:16
#15 0x19bdce9 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/ch/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1616:23
#16 0x19bd8de llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/ch/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1723:16
#17 0x19be191 llvm::legacy::PassManager::run(llvm::Module&) /home/ch/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1756:3
#18 0x784481 compileModule(char**, llvm::LLVMContext&) /home/ch/sources-llvm/llvm/tools/llc/llc.cpp:378:3
#19 0x7832f6 main /home/ch/sources-llvm/llvm/tools/llc/llc.cpp:201:13
#20 0x7f6b0bbc6b45 __libc_start_main /build/glibc-Ir_s5K/glibc-2.19/csu/libc-start.c:321:0
#21 0x783014 _start (/home/ch/build-debug/bin/llc+0x783014)
Stack dump:
0.	Program arguments: /home/ch/build-debug/bin/llc -O0 -march=r600 
1.	Running pass 'Function Pass Manager' on module '<stdin>'.
2.	Running pass 'Fast Register Allocator' on function '@test_trunc65'

$llc -O2 -march=r600 seems fine


I used a llvm trunk/235497 built on Linux.
Comment 1 Matt Arsenault 2016-03-07 10:18:29 PST
This is from r600 not implementing register spilling. It works on amdgcn. This will be fixed if anyone ever comes and implements it, but there aren't any plans to add new features for r600. It's surprising that any of these tests get that far, since return values don't work for kernel functions, so functions like this end up empty.