llvm / llvm/llvm-project

[AMDGPU] "Interference" assertion in SplitEditor::splitLiveThroughBlock during regalloc

Open
#199,554 0 comments 0 reactions 0 assignees View on GitHub
confirmed crash-on-valid generated by fuzzer
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Live Reproducer: https://godbolt.org/z/4xb9YW5r6

Compiling the following LLVM IR with `llc -mcpu=gfx1100` aborts with the assertion `(!LeaveBefore || Idx <= LeaveBefore) && "Interference"` failed during the Greedy Register Allocator.

```llvm
target triple = "amdgcn-amd-amdhsa"

define void @f(<286 x i1> %vloop.seed0, ptr %addr) {
br label %h2
h2:
%vloop0 = phi <286 x i1> [%vloop.seed0, %0], [%vloop.next0, %lt3]
indirectbr ptr %addr, [label %ib5, label %ib6]
ib5:
call void asm sideeffect "", ""()
br label %lt3
ib6:
br label %h8
h8:
%iv5 = phi i32 [0, %ib6], [%ivn5, %h8]
%vloop4 = phi <286 x i1> [%vloop0, %ib6], [%vloop.next4, %h8]
%depout7 = xor <286 x i1> %vloop4, %vloop0
%ivn5 = add i32 %iv5, 1
%vloop.shuf4 = shufflevector <286 x i1> %vloop4, <286 x i1> %depout7, <286 x i32> splat (i32 286)
%vloop.next4 = xor <286 x i1> %vloop.shuf4, %vloop4
%dn5 = icmp uge i32 %ivn5, 2
br i1 %dn5, label %lt3, label %h8
lt3:
%vloop.shuf0 = shufflevector <286 x i1> %vloop0, <286 x i1> poison, <286 x i32> zeroinitializer
%vloop.next0 = xor <286 x i1> %vloop.shuf0, %vloop0
br label %h2
}
```

llc command:

```sh
llc -mcpu=gfx1100 repro.ll
```

Error output:

```
llc: /root/llvm-project/llvm/lib/CodeGen/SplitKit.cpp:1704: void llvm::SplitEditor::splitLiveThroughBlock(unsigned int, unsigned int, llvm::SlotIndex, unsigned int, llvm::SlotIndex): Assertion `(!LeaveBefore || Idx <= LeaveBefore) && "Interference"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mcpu=gfx1100
1. Running pass 'CallGraph Pass Manager' on module ''.
2. Running pass 'Greedy Register Allocator' on function '@f'
#9 0x0000000003688348 llvm::SplitEditor::splitLiveThroughBlock(unsigned int, unsigned int, llvm::SlotIndex, unsigned int, llvm::SlotIndex) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3688348)
#10 0x000000000359be6e llvm::RAGreedy::splitAroundRegion(llvm::LiveRangeEdit&, llvm::ArrayRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x359be6e)
#11 0x000000000359d061 llvm::RAGreedy::doRegionSplit(llvm::LiveInterval const&, unsigned int, bool, llvm::SmallVectorImpl&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x359d061)
#12 0x00000000035a28e0 llvm::RAGreedy::tryRegionSplit(llvm::LiveInterval const&, llvm::AllocationOrder&, llvm::SmallVectorImpl&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x35a28e0)
...
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.