Skip to content

Commit 8c7f8c6

Browse files
committed
Also handle fixed-length splats, as a sort of fast-path. Should be NFC?
1 parent d26e672 commit 8c7f8c6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,11 +1684,10 @@ static Type *getMinimumFPType(Value *V, bool PreferBFloat) {
16841684
if (Type *T = shrinkFPConstant(CFP, PreferBFloat))
16851685
return T;
16861686

1687-
// We can only correctly find a minimum type for a scalable vector when it is
1688-
// a splat.
1689-
if (auto *FPCE = dyn_cast<ConstantExpr>(V))
1690-
if (isa<ScalableVectorType>(V->getType()))
1691-
if (auto *Splat = dyn_cast<ConstantFP>(FPCE->getSplatValue()))
1687+
// Try to shrink scalable and fixed splat vectors.
1688+
if (auto *FPC = dyn_cast<Constant>(V))
1689+
if (isa<VectorType>(V->getType()))
1690+
if (auto *Splat = dyn_cast_or_null<ConstantFP>(FPC->getSplatValue()))
16921691
if (Type *T = shrinkFPConstant(Splat, PreferBFloat))
16931692
return T;
16941693

0 commit comments

Comments
 (0)