Skip to content

Commit a6fa720

Browse files
committed
[Hexagon] Simplify creation of splat value (NFC)
ConstantInt::get() already knows how to create splats, no need to do it manually.
1 parent bf41fd7 commit a6fa720

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/Target/Hexagon/HexagonGenWideningVecInstr.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,9 @@ void HexagonGenWideningVecInstr::updateMPYConst(Intrinsic::ID IntId,
492492
IntId == Intrinsic::hexagon_vmpy_ss) &&
493493
OP->getType()->isVectorTy()) {
494494
// Create a vector with all elements equal to SplatVal
495-
auto *VecTy = cast<VectorType>(OP->getType());
496-
Value *scalar = IRB.getIntN(VecTy->getScalarSizeInBits(),
497-
static_cast<uint32_t>(SplatVal));
498-
Value *splatVector = ConstantVector::getSplat(VecTy->getElementCount(),
499-
cast<Constant>(scalar));
495+
Type *VecTy = OP->getType();
496+
Value *splatVector =
497+
ConstantInt::get(VecTy, static_cast<uint32_t>(SplatVal));
500498
OP = IsOPZExt ? IRB.CreateZExt(splatVector, VecTy)
501499
: IRB.CreateSExt(splatVector, VecTy);
502500
} else {

0 commit comments

Comments
 (0)