[llvm] [InstCombine] Fix Failure to convert vector fp comparisons that can be represented as integers #82241 (PR #83274)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 28 07:44:52 PST 2024
================
@@ -7286,6 +7286,10 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
Instruction *InstCombinerImpl::foldFCmpIntToFPConst(FCmpInst &I,
Instruction *LHSI,
Constant *RHSC) {
+ if (RHSC->getType()->isVectorTy()) {
+ if (Constant *CV = RHSC->getSplatValue(false))
+ RHSC = CV;
+ }
if (!isa<ConstantFP>(RHSC)) return nullptr;
const APFloat &RHS = cast<ConstantFP>(RHSC)->getValueAPF();
----------------
dtcxzyw wrote:
```suggestion
const APFloat *RHS;
if (!match(RHSC, m_APFloat(RHS)))
return nullptr;
```
https://github.com/llvm/llvm-project/pull/83274
More information about the llvm-commits
mailing list