missed instcombine fptoui(fadd(uitofp(x), c)) ->x if 0<= c<1
Open
llvm:instcombine
missed-optimization
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```llvm
define i16 @uitofp_fadd_half_fptoui(i16 %x) {
%f = uitofp i16 %x to float
%rounded = fadd float %f, 5.000000e-01
%back = fptoui float %rounded to i16
ret i16 %back
}
```
can be transformed to
```llvm
define i16 @uitofp_fadd_half_fptoui(i16 %x) {
ret i16 %x
}
```
Contributor guide
Research direction
Start by reproducing the provided LLVM IR example and inspect the InstCombine handling for the uitofp, fadd, and fptoui sequence. Done means the example is reliably transformed to return %x, with coverage for the stated 0 <= c < 1 case.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100