[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:45 PST 2024


================
@@ -7298,6 +7302,16 @@ Instruction *InstCombinerImpl::foldFCmpIntToFPConst(FCmpInst &I,
   unsigned IntWidth = IntTy->getScalarSizeInBits();
   bool LHSUnsigned = isa<UIToFPInst>(LHSI);
 
+  Value *False, *True;
+  if (IntTy->isVectorTy()) {
+    ElementCount EC = cast<VectorType>(IntTy)->getElementCount();
+    True = Builder.CreateVectorSplat(EC, Builder.getTrue());
+    False = Builder.CreateVectorSplat(EC, Builder.getFalse());
----------------
RKSimon wrote:

@nikic Is there a better way to do this - could we create Builder.getTrue(Type*) variants?

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


More information about the llvm-commits mailing list