[llvm] 86a5a75 - [InstCombine] Use canonical index type in more places

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 09:06:16 PDT 2023


Author: Nikita Popov
Date: 2023-05-17T18:06:08+02:00
New Revision: 86a5a7504916d7c82379aabe5f2cd86ec4dee6cd

URL: https://github.com/llvm/llvm-project/commit/86a5a7504916d7c82379aabe5f2cd86ec4dee6cd
DIFF: https://github.com/llvm/llvm-project/commit/86a5a7504916d7c82379aabe5f2cd86ec4dee6cd.diff

LOG: [InstCombine] Use canonical index type in more places

Also fixes an issue with 80cd3e4e2059f8deda735c32bf7dfa5b9d75c4e0
pointed out by Roman Divacky: For one of the occurrences I only
changed the name of the type variable, without actually changing
the type...

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 86ba0be5d8f7..00fc8b1c03b5 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -550,9 +550,9 @@ Instruction *InstCombinerImpl::visitExtractElementInst(ExtractElementInst &EI) {
           SrcIdx -= LHSWidth;
           Src = SVI->getOperand(1);
         }
-        Type *Int32Ty = Type::getInt32Ty(EI.getContext());
+        Type *Int64Ty = Type::getInt64Ty(EI.getContext());
         return ExtractElementInst::Create(
-            Src, ConstantInt::get(Int32Ty, SrcIdx, false));
+            Src, ConstantInt::get(Int64Ty, SrcIdx, false));
       }
     } else if (auto *CI = dyn_cast<CastInst>(I)) {
       // Canonicalize extractelement(cast) -> cast(extractelement).
@@ -1250,7 +1250,7 @@ static Instruction *foldInsSequenceIntoSplat(InsertElementInst &InsElt) {
       return nullptr;
 
   // Create the insert + shuffle.
-  Type *Int64Ty = Type::getInt32Ty(InsElt.getContext());
+  Type *Int64Ty = Type::getInt64Ty(InsElt.getContext());
   PoisonValue *PoisonVec = PoisonValue::get(VecTy);
   Constant *Zero = ConstantInt::get(Int64Ty, 0);
   if (!cast<ConstantInt>(FirstIE->getOperand(2))->isZero())


        


More information about the llvm-commits mailing list