Missed optimization: fold fcmp (fmul x, C), 0.0 to fcmp x, 0.0 when C > 0.0
Open
Nobody has claimed this yet.
llvm:instcombine
missed-optimization
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
define i1 @src(double %arg0) {
%v0 = fmul double %arg0, 1.000000e+06
%v1 = fcmp ule double %v0, 0.000000e+00
ret i1 %v1
}
define i1 @tgt(double %arg0) {
%v1 = fcmp ule double %arg0, 0.000000e+00
ret i1 %v1
}
godbolt: https://godbolt.org/z/PrYYMnf1o
alive2: https://alive2.llvm.org/ce/z/Dfj9iw
Pattern found in: https://github.com/dtcxzyw/llvm-opt-benchmark/blob/main/bench/faiss/optimized/sysinfo.ll
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the LLVM IR reproducer and validate the proposed transform using the linked Godbolt and Alive2 examples. Trace the optimization responsible for folding the fcmp/fmul pattern, using the benchmark reference at faiss/optimized/sysinfo.ll as context. Done means the transformation is proven valid and protected by a regression test.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100