[llvm] [LLVM][InstCombine] Preserve vector types when shrinking FP constants. (PR #163598)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 16 09:57:09 PDT 2025


================
@@ -1720,10 +1730,10 @@ static Type *getMinimumFPType(Value *V, bool PreferBFloat) {
 
   // Try to shrink scalable and fixed splat vectors.
   if (auto *FPC = dyn_cast<Constant>(V))
-    if (isa<VectorType>(V->getType()))
+    if (auto *VTy = dyn_cast<VectorType>(V->getType()))
       if (auto *Splat = dyn_cast_or_null<ConstantFP>(FPC->getSplatValue()))
         if (Type *T = shrinkFPConstant(Splat, PreferBFloat))
-          return T;
+          return VectorType::get(T, VTy);
----------------
paulwalker-arm wrote:

Only the Instruction::FRem handling uses getMinimumFPType()'s return type and even then the bug only occurs when LHS is the vector splat of which there were no tests.

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


More information about the llvm-commits mailing list