aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Constants.cpp
diff options
context:
space:
mode:
authorPaul Walker <paul.walker@arm.com>2023-01-04 11:45:54 +0000
committerPaul Walker <paul.walker@arm.com>2023-01-11 14:08:06 +0000
commiteae26b6640afff715172d75fdee02e7df7530a9b (patch)
treea824244d3b6a9297bfa853bf6f7e2596f730e44f /llvm/lib/IR/Constants.cpp
parent4313b6f9ebc2556ff039249691a4dc619e32840c (diff)
downloadllvm-eae26b6640afff715172d75fdee02e7df7530a9b.zip
llvm-eae26b6640afff715172d75fdee02e7df7530a9b.tar.gz
llvm-eae26b6640afff715172d75fdee02e7df7530a9b.tar.bz2
[IRBuilder] Use canonical i64 type for insertelement index used by vector splats.
Instcombine prefers this canonical form (see getPreferredVectorIndex), as does IRBuilder when passing the index as an integer so we may as well use the prefered form from creation. NOTE: All test changes are mechanical with nothing else expected beyond a change of index type from i32 to i64. Differential Revision: https://reviews.llvm.org/D140983
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r--llvm/lib/IR/Constants.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index f777b1b..a536711 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -1415,11 +1415,11 @@ Constant *ConstantVector::getSplat(ElementCount EC, Constant *V) {
else if (isa<UndefValue>(V))
return UndefValue::get(VTy);
- Type *I32Ty = Type::getInt32Ty(VTy->getContext());
+ Type *IdxTy = Type::getInt64Ty(VTy->getContext());
// Move scalar into vector.
Constant *PoisonV = PoisonValue::get(VTy);
- V = ConstantExpr::getInsertElement(PoisonV, V, ConstantInt::get(I32Ty, 0));
+ V = ConstantExpr::getInsertElement(PoisonV, V, ConstantInt::get(IdxTy, 0));
// Build shuffle mask to perform the splat.
SmallVector<int, 8> Zeros(EC.getKnownMinValue(), 0);
// Splat.