[M68k] selection failure on load from global
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This seems closely related to https://github.com/llvm/llvm-project/issues/200826 (closed by https://github.com/llvm/llvm-project/pull/201653). I hit this when compiling the rust standard library.
https://godbolt.org/z/jaehYq6oG
```llvm
@counter = internal global i64 0, align 8
define void @foo(i32 %x) {
entry:
%p = getelementptr inbounds i8, ptr @counter, i32 4
store i32 %x, ptr %p, align 4
ret void
}
```
For `-mtriple=m68k-unknown-linux-gnu` gives
```
LLVM ERROR: Cannot select: t8: ch = store<(store (s32) into %ir.p)> t0, t3, t6, poison:i32
t3: i32,ch = load<(load (s32) from %fixed-stack.0, align 8)> t0, FrameIndex:i32<-1>, poison:i32
t6: i32 = add nuw t12, Constant:i32<4>
t12: i32 = M68kISD::WrapperPC TargetGlobalAddress:i32 0
In function: foo
```
Contributor guide
Research direction
Reproduce the failure with the LLVM IR snippet and -mtriple=m68k-unknown-linux-gnu, then trace the M68k instruction-selection path around M68kISD::WrapperPC and the global address. Done means the example compiles without the reported LLVM ERROR, including the Rust standard-library case that exposed it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100