KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator
llvm.sadd.with.overflow: vector types not lowered
- Dominant language
- LLVM
- Stars
- 625
- Forks
- 279
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
Currently `SPIRVLowerLLVMIntrinsic.cpp` maps `llvm.sadd.with.overflow` for scalar types `i8`/`i16`/`i32`/`i64` only (the `i8` entry was added by #3673).
Vector variants are entirely absent from the map, so any LLVM IR using e.g. `llvm.sadd.with.overflow.v2i32` fails to translate.
SPIR-V supports integer vectors of 2, 3, 4, 8, and 16 components, leaving 20 vector variants uncovered: `v{2,3,4,8,16}i{8,16,32,64}`.
The proper fix, as noted in the review of #3673, is to replace the hand-authored IR strings in `LLVMSaddWithOverflow.h` with a programmatic IR expansion pass that generates the lowering for every valid type at translation time.
Contributor guide
Research direction
Start by reading SPIRVLowerLLVMIntrinsic.cpp and the hand-authored IR in LLVMSaddWithOverflow.h, then review the approach discussed in #3673. Determine how a programmatic IR expansion can cover the valid scalar and vector types at translation time. Done means all v{2,3,4,8,16}i{8,16,32,64} variants of llvm.sadd.with.overflow translate successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100