@@ -100,21 +100,21 @@ class InterleavedAccessImpl {
100
100
101
101
// / Transform an interleaved load into target specific intrinsics.
102
102
bool lowerInterleavedLoad (LoadInst *LI,
103
- SmallVectorImpl <Instruction *> &DeadInsts);
103
+ SmallSetVector <Instruction *, 32 > &DeadInsts);
104
104
105
105
// / Transform an interleaved store into target specific intrinsics.
106
106
bool lowerInterleavedStore (StoreInst *SI,
107
- SmallVectorImpl <Instruction *> &DeadInsts);
107
+ SmallSetVector <Instruction *, 32 > &DeadInsts);
108
108
109
109
// / Transform a load and a deinterleave intrinsic into target specific
110
110
// / instructions.
111
111
bool lowerDeinterleaveIntrinsic (IntrinsicInst *II,
112
- SmallVectorImpl <Instruction *> &DeadInsts);
112
+ SmallSetVector <Instruction *, 32 > &DeadInsts);
113
113
114
114
// / Transform an interleave intrinsic and a store into target specific
115
115
// / instructions.
116
116
bool lowerInterleaveIntrinsic (IntrinsicInst *II,
117
- SmallVectorImpl <Instruction *> &DeadInsts);
117
+ SmallSetVector <Instruction *, 32 > &DeadInsts);
118
118
119
119
// / Returns true if the uses of an interleaved load by the
120
120
// / extractelement instructions in \p Extracts can be replaced by uses of the
@@ -249,7 +249,7 @@ static bool isReInterleaveMask(ShuffleVectorInst *SVI, unsigned &Factor,
249
249
}
250
250
251
251
bool InterleavedAccessImpl::lowerInterleavedLoad (
252
- LoadInst *LI, SmallVectorImpl <Instruction *> &DeadInsts) {
252
+ LoadInst *LI, SmallSetVector <Instruction *, 32 > &DeadInsts) {
253
253
if (!LI->isSimple () || isa<ScalableVectorType>(LI->getType ()))
254
254
return false ;
255
255
@@ -348,9 +348,9 @@ bool InterleavedAccessImpl::lowerInterleavedLoad(
348
348
return !Extracts.empty () || BinOpShuffleChanged;
349
349
}
350
350
351
- append_range ( DeadInsts, Shuffles);
351
+ DeadInsts. insert (Shuffles. begin () , Shuffles. end () );
352
352
353
- DeadInsts.push_back (LI);
353
+ DeadInsts.insert (LI);
354
354
return true ;
355
355
}
356
356
@@ -453,7 +453,7 @@ bool InterleavedAccessImpl::tryReplaceExtracts(
453
453
}
454
454
455
455
bool InterleavedAccessImpl::lowerInterleavedStore (
456
- StoreInst *SI, SmallVectorImpl <Instruction *> &DeadInsts) {
456
+ StoreInst *SI, SmallSetVector <Instruction *, 32 > &DeadInsts) {
457
457
if (!SI->isSimple ())
458
458
return false ;
459
459
@@ -473,13 +473,13 @@ bool InterleavedAccessImpl::lowerInterleavedStore(
473
473
return false ;
474
474
475
475
// Already have a new target specific interleaved store. Erase the old store.
476
- DeadInsts.push_back (SI);
477
- DeadInsts.push_back (SVI);
476
+ DeadInsts.insert (SI);
477
+ DeadInsts.insert (SVI);
478
478
return true ;
479
479
}
480
480
481
481
bool InterleavedAccessImpl::lowerDeinterleaveIntrinsic (
482
- IntrinsicInst *DI, SmallVectorImpl <Instruction *> &DeadInsts) {
482
+ IntrinsicInst *DI, SmallSetVector <Instruction *, 32 > &DeadInsts) {
483
483
LoadInst *LI = dyn_cast<LoadInst>(DI->getOperand (0 ));
484
484
485
485
if (!LI || !LI->hasOneUse () || !LI->isSimple ())
@@ -488,17 +488,19 @@ bool InterleavedAccessImpl::lowerDeinterleaveIntrinsic(
488
488
LLVM_DEBUG (dbgs () << " IA: Found a deinterleave intrinsic: " << *DI << " \n " );
489
489
490
490
// Try and match this with target specific intrinsics.
491
- if (!TLI->lowerDeinterleaveIntrinsicToLoad (DI, LI, DeadInsts))
491
+ SmallVector<Instruction *, 4 > DeinterleaveDeadInsts;
492
+ if (!TLI->lowerDeinterleaveIntrinsicToLoad (DI, LI, DeinterleaveDeadInsts))
492
493
return false ;
493
494
495
+ DeadInsts.insert (DeinterleaveDeadInsts.begin (), DeinterleaveDeadInsts.end ());
494
496
// We now have a target-specific load, so delete the old one.
495
- DeadInsts.push_back (DI);
496
- DeadInsts.push_back (LI);
497
+ DeadInsts.insert (DI);
498
+ DeadInsts.insert (LI);
497
499
return true ;
498
500
}
499
501
500
502
bool InterleavedAccessImpl::lowerInterleaveIntrinsic (
501
- IntrinsicInst *II, SmallVectorImpl <Instruction *> &DeadInsts) {
503
+ IntrinsicInst *II, SmallSetVector <Instruction *, 32 > &DeadInsts) {
502
504
if (!II->hasOneUse ())
503
505
return false ;
504
506
@@ -515,16 +517,15 @@ bool InterleavedAccessImpl::lowerInterleaveIntrinsic(
515
517
return false ;
516
518
517
519
// We now have a target-specific store, so delete the old one.
518
- DeadInsts.push_back (SI);
519
- DeadInsts.push_back (II);
520
- DeadInsts.insert (DeadInsts.end (), InterleaveDeadInsts.begin (),
521
- InterleaveDeadInsts.end ());
520
+ DeadInsts.insert (SI);
521
+ DeadInsts.insert (II);
522
+ DeadInsts.insert (InterleaveDeadInsts.begin (), InterleaveDeadInsts.end ());
522
523
return true ;
523
524
}
524
525
525
526
bool InterleavedAccessImpl::runOnFunction (Function &F) {
526
527
// Holds dead instructions that will be erased later.
527
- SmallVector <Instruction *, 32 > DeadInsts;
528
+ SmallSetVector <Instruction *, 32 > DeadInsts;
528
529
bool Changed = false ;
529
530
530
531
for (auto &I : instructions (F)) {
0 commit comments