[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:53 PST 2024
================
@@ -7511,6 +7525,13 @@ Instruction *InstCombinerImpl::foldFCmpIntToFPConst(FCmpInst &I,
}
}
+ if (IntTy->isVectorTy()) {
+ Value *RHSV = Builder.CreateVectorSplat(
+ cast<VectorType>(IntTy)->getElementCount(),
+ Builder.getInt(RHSInt));
+ return new ICmpInst(Pred, LHSI->getOperand(0), RHSV);
+ }
+
// Lower this FP comparison into an appropriate integer version of the
// comparison.
return new ICmpInst(Pred, LHSI->getOperand(0), Builder.getInt(RHSInt));
----------------
dtcxzyw wrote:
```suggestion
return new ICmpInst(Pred, LHSI->getOperand(0), ConstantInt::get(LHSI->getOperand(0)->getType(), RHSInt));
```
https://github.com/llvm/llvm-project/pull/83274
More information about the llvm-commits
mailing list