@@ -384,7 +384,7 @@ static APInt findDemandedEltsByAllUsers(Value *V) {
384
384
// / return it with the canonical type if it isn't already canonical. We
385
385
// / arbitrarily pick 64 bit as our canonical type. The actual bitwidth doesn't
386
386
// / matter, we just want a consistent type to simplify CSE.
387
- ConstantInt *getPreferredVectorIndex (ConstantInt *IndexC) {
387
+ static ConstantInt *getPreferredVectorIndex (ConstantInt *IndexC) {
388
388
const unsigned IndexBW = IndexC->getType ()->getBitWidth ();
389
389
if (IndexBW == 64 || IndexC->getValue ().getActiveBits () > 64 )
390
390
return nullptr ;
@@ -2183,8 +2183,7 @@ static Instruction *canonicalizeInsertSplat(ShuffleVectorInst &Shuf,
2183
2183
2184
2184
// Insert into element 0 of an undef vector.
2185
2185
UndefValue *UndefVec = UndefValue::get (Shuf.getType ());
2186
- Constant *Zero = Builder.getInt32 (0 );
2187
- Value *NewIns = Builder.CreateInsertElement (UndefVec, X, Zero);
2186
+ Value *NewIns = Builder.CreateInsertElement (UndefVec, X, (uint64_t )0 );
2188
2187
2189
2188
// Splat from element 0. Any mask element that is undefined remains undefined.
2190
2189
// For example:
@@ -2779,7 +2778,6 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
2779
2778
}
2780
2779
2781
2780
ArrayRef<int > Mask = SVI.getShuffleMask ();
2782
- Type *Int32Ty = Type::getInt32Ty (SVI.getContext ());
2783
2781
2784
2782
// Peek through a bitcasted shuffle operand by scaling the mask. If the
2785
2783
// simulated shuffle can simplify, then this shuffle is unnecessary:
@@ -2943,8 +2941,8 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
2943
2941
: Builder.CreateBitCast (V, CastSrcTy, SVI.getName () + " .bc" );
2944
2942
if (!BCAlreadyExists)
2945
2943
NewBCs[CastSrcTy] = NewBC;
2946
- auto *Ext = Builder.CreateExtractElement (
2947
- NewBC, ConstantInt::get (Int32Ty, BegIdx), SVI.getName () + " .extract" );
2944
+ auto *Ext = Builder.CreateExtractElement (NewBC, BegIdx,
2945
+ SVI.getName () + " .extract" );
2948
2946
// The shufflevector isn't being replaced: the bitcast that used it
2949
2947
// is. InstCombine will visit the newly-created instructions.
2950
2948
replaceInstUsesWith (*BC, Ext);
0 commit comments