[llvm] [InstCombine] Fix Failure to convert vector fp comparisons that can be represented as integers #82241 (PR #83274)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 08:11:44 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;
+  }
----------------
RKSimon wrote:

No need to check isVectorTy - its safe to just do:
```cpp
if (Constant *CV = RHSC->getSplatValue(false))
  RHSC = CV;
```

https://github.com/llvm/llvm-project/pull/83274


More information about the llvm-commits mailing list