[llvm] 80cd3e4 - [InstCombine] Use canonical type in insertelement (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed May 17 05:37:41 PDT 2023
Author: Nikita Popov
Date: 2023-05-17T14:37:32+02:00
New Revision: 80cd3e4e2059f8deda735c32bf7dfa5b9d75c4e0
URL: https://github.com/llvm/llvm-project/commit/80cd3e4e2059f8deda735c32bf7dfa5b9d75c4e0
DIFF: https://github.com/llvm/llvm-project/commit/80cd3e4e2059f8deda735c32bf7dfa5b9d75c4e0.diff
LOG: [InstCombine] Use canonical type in insertelement (NFC)
We can directly create these with the correct type.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 3739497949d31..231739d903b3d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -1542,7 +1542,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
// Found constant vector with single element - convert to insertelement.
if (Op && Value) {
Instruction *New = InsertElementInst::Create(
- Op, Value, ConstantInt::get(Type::getInt32Ty(I->getContext()), Idx),
+ Op, Value, ConstantInt::get(Type::getInt64Ty(I->getContext()), Idx),
Shuffle->getName());
InsertNewInstWith(New, *Shuffle);
return New;
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 4bab964aa14d6..f077f6f290307 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -1249,9 +1249,9 @@ static Instruction *foldInsSequenceIntoSplat(InsertElementInst &InsElt) {
return nullptr;
// Create the insert + shuffle.
- Type *Int32Ty = Type::getInt32Ty(InsElt.getContext());
+ Type *Int64Ty = Type::getInt32Ty(InsElt.getContext());
PoisonValue *PoisonVec = PoisonValue::get(VecTy);
- Constant *Zero = ConstantInt::get(Int32Ty, 0);
+ Constant *Zero = ConstantInt::get(Int64Ty, 0);
if (!cast<ConstantInt>(FirstIE->getOperand(2))->isZero())
FirstIE = InsertElementInst::Create(PoisonVec, SplatVal, Zero, "", &InsElt);
More information about the llvm-commits
mailing list