[llvm] 80cd3e4 - [InstCombine] Use canonical type in insertelement (NFC)

Roman Divacky via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 08:49:48 PDT 2023


On Wed, May 17, 2023 at 05:37:41AM -0700, Nikita Popov via llvm-commits wrote:
> 
> 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());

This doesn't change anything except the name of the variable, right? Is it
intended?

Thanks, Roman


More information about the llvm-commits mailing list