llvm / llvm/llvm-project

[InstCombine] Simplify select pattern of 'sitofp/uitofp + redundant fcmp/select' using ConstantFPRange

Open
#174,308 0 comments 0 reactions 0 assignees View on GitHub
llvm:instcombine missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

PR https://github.com/llvm/llvm-project/pull/173452 removes redundant fcmp and select, but the approach can be improved:

>> Or alternatively, if we have to match the full pattern anyway, wouldn't it make more sense to make this an explicit pattern in visitSelect (or even simplifySelectInst)?

> I'd prefer this approach after the ConstantFPRange support for uitofp/sitofp is ready. Then we can handle other variants in https://github.com/dtcxzyw/llvm-opt-benchmark/pull/3210/files as well. But for now, relaxing the bailout is the cheapest way to achieve the goal (at least I don't need to care about FMF propagations/+-0/...).

_Originally posted by @dtcxzyw in https://github.com/llvm/llvm-project/issues/173452#issuecomment-3691523537_

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.