41
41
#include " llvm/Analysis/LoopAccessAnalysis.h"
42
42
#include " llvm/Analysis/LoopInfo.h"
43
43
#include " llvm/Analysis/MemoryLocation.h"
44
- #include " llvm/Analysis/MemorySSA.h"
45
- #include " llvm/Analysis/MemorySSAUpdater.h"
46
44
#include " llvm/Analysis/OptimizationRemarkEmitter.h"
47
45
#include " llvm/Analysis/ScalarEvolution.h"
48
46
#include " llvm/Analysis/ScalarEvolutionExpressions.h"
@@ -168,10 +166,6 @@ static cl::opt<bool>
168
166
ViewSLPTree (" view-slp-tree" , cl::Hidden,
169
167
cl::desc (" Display the SLP trees with Graphviz" ));
170
168
171
- static cl::opt<bool > EnableMSSAInSLPVectorizer (
172
- " enable-mssa-in-slp-vectorizer" , cl::Hidden, cl::init(false ),
173
- cl::desc(" Enable MemorySSA for SLPVectorizer in new pass manager" ));
174
-
175
169
// Limit the number of alias checks. The limit is chosen so that
176
170
// it has no negative effect on the llvm benchmarks.
177
171
static const unsigned AliasedCheckLimit = 10 ;
@@ -846,10 +840,9 @@ class BoUpSLP {
846
840
BoUpSLP (Function *Func, ScalarEvolution *Se, TargetTransformInfo *Tti,
847
841
TargetLibraryInfo *TLi, AAResults *Aa, LoopInfo *Li,
848
842
DominatorTree *Dt, AssumptionCache *AC, DemandedBits *DB,
849
- MemorySSA *MSSA, const DataLayout *DL, OptimizationRemarkEmitter *ORE)
843
+ const DataLayout *DL, OptimizationRemarkEmitter *ORE)
850
844
: BatchAA(*Aa), F(Func), SE(Se), TTI(Tti), TLI(TLi), LI(Li),
851
- DT (Dt), AC(AC), DB(DB), MSSA(MSSA), DL(DL), ORE(ORE),
852
- Builder(Se->getContext ()) {
845
+ DT (Dt), AC(AC), DB(DB), DL(DL), ORE(ORE), Builder(Se->getContext ()) {
853
846
CodeMetrics::collectEphemeralValues (F, AC, EphValues);
854
847
// Use the vector register size specified by the target unless overridden
855
848
// by a command-line option.
@@ -3057,7 +3050,6 @@ class BoUpSLP {
3057
3050
DominatorTree *DT;
3058
3051
AssumptionCache *AC;
3059
3052
DemandedBits *DB;
3060
- MemorySSA *MSSA;
3061
3053
const DataLayout *DL;
3062
3054
OptimizationRemarkEmitter *ORE;
3063
3055
@@ -3170,13 +3162,6 @@ template <> struct DOTGraphTraits<BoUpSLP *> : public DefaultDOTGraphTraits {
3170
3162
} // end namespace llvm
3171
3163
3172
3164
BoUpSLP::~BoUpSLP () {
3173
- if (MSSA) {
3174
- MemorySSAUpdater MSSAU (MSSA);
3175
- for (const auto &Pair : DeletedInstructions) {
3176
- if (auto *Access = MSSA->getMemoryAccess (Pair.first ))
3177
- MSSAU.removeMemoryAccess (Access);
3178
- }
3179
- }
3180
3165
for (const auto &Pair : DeletedInstructions) {
3181
3166
// Replace operands of ignored instructions with Undefs in case if they were
3182
3167
// marked for deletion.
@@ -6919,15 +6904,6 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
6919
6904
auto *PtrTy = PointerType::get (VecTy, LI->getPointerAddressSpace ());
6920
6905
Value *Ptr = Builder.CreateBitCast (LI->getOperand (0 ), PtrTy);
6921
6906
LoadInst *V = Builder.CreateAlignedLoad (VecTy, Ptr, LI->getAlign ());
6922
- if (MSSA) {
6923
- MemorySSAUpdater MSSAU (MSSA);
6924
- auto *Access = MSSA->getMemoryAccess (LI);
6925
- assert (Access);
6926
- MemoryUseOrDef *NewAccess =
6927
- MSSAU.createMemoryAccessBefore (V, Access->getDefiningAccess (),
6928
- Access);
6929
- MSSAU.insertUse (cast<MemoryUse>(NewAccess), true );
6930
- }
6931
6907
Value *NewV = propagateMetadata (V, E->Scalars );
6932
6908
ShuffleBuilder.addInversedMask (E->ReorderIndices );
6933
6909
ShuffleBuilder.addMask (E->ReuseShuffleIndices );
@@ -7177,17 +7153,6 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
7177
7153
commonAlignment (CommonAlignment, cast<LoadInst>(V)->getAlign ());
7178
7154
NewLI = Builder.CreateMaskedGather (VecTy, VecPtr, CommonAlignment);
7179
7155
}
7180
-
7181
- if (MSSA) {
7182
- MemorySSAUpdater MSSAU (MSSA);
7183
- auto *Access = MSSA->getMemoryAccess (LI);
7184
- assert (Access);
7185
- MemoryUseOrDef *NewAccess =
7186
- MSSAU.createMemoryAccessAfter (NewLI, Access->getDefiningAccess (),
7187
- Access);
7188
- MSSAU.insertUse (cast<MemoryUse>(NewAccess), true );
7189
- }
7190
-
7191
7156
Value *V = propagateMetadata (NewLI, E->Scalars );
7192
7157
7193
7158
ShuffleBuilder.addInversedMask (E->ReorderIndices );
@@ -7213,16 +7178,6 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
7213
7178
StoreInst *ST =
7214
7179
Builder.CreateAlignedStore (VecValue, VecPtr, SI->getAlign ());
7215
7180
7216
- if (MSSA) {
7217
- MemorySSAUpdater MSSAU (MSSA);
7218
- auto *Access = MSSA->getMemoryAccess (SI);
7219
- assert (Access);
7220
- MemoryUseOrDef *NewAccess =
7221
- MSSAU.createMemoryAccessAfter (ST, Access->getDefiningAccess (),
7222
- Access);
7223
- MSSAU.insertDef (cast<MemoryDef>(NewAccess), true );
7224
- }
7225
-
7226
7181
// The pointer operand uses an in-tree scalar, so add the new BitCast or
7227
7182
// StoreInst to ExternalUses to make sure that an extract will be
7228
7183
// generated in the future.
@@ -8205,15 +8160,6 @@ void BoUpSLP::scheduleBlock(BlockScheduling *BS) {
8205
8160
BS->initialFillReadyList (ReadyInsts);
8206
8161
8207
8162
Instruction *LastScheduledInst = BS->ScheduleEnd ;
8208
- MemoryAccess *MemInsertPt = nullptr ;
8209
- if (MSSA) {
8210
- for (auto I = LastScheduledInst->getIterator (); I != BS->BB ->end (); I++) {
8211
- if (auto *Access = MSSA->getMemoryAccess (&*I)) {
8212
- MemInsertPt = Access;
8213
- break ;
8214
- }
8215
- }
8216
- }
8217
8163
8218
8164
// Do the "real" scheduling.
8219
8165
while (!ReadyInsts.empty ()) {
@@ -8225,24 +8171,9 @@ void BoUpSLP::scheduleBlock(BlockScheduling *BS) {
8225
8171
for (ScheduleData *BundleMember = picked; BundleMember;
8226
8172
BundleMember = BundleMember->NextInBundle ) {
8227
8173
Instruction *pickedInst = BundleMember->Inst ;
8228
- if (pickedInst->getNextNode () != LastScheduledInst) {
8174
+ if (pickedInst->getNextNode () != LastScheduledInst)
8229
8175
pickedInst->moveBefore (LastScheduledInst);
8230
- if (MSSA) {
8231
- MemorySSAUpdater MSSAU (MSSA);
8232
- if (auto *Access = MSSA->getMemoryAccess (pickedInst)) {
8233
- if (MemInsertPt)
8234
- MSSAU.moveBefore (Access, cast<MemoryUseOrDef>(MemInsertPt));
8235
- else
8236
- MSSAU.moveToPlace (Access, BS->BB ,
8237
- MemorySSA::InsertionPlace::End);
8238
- }
8239
- }
8240
- }
8241
-
8242
8176
LastScheduledInst = pickedInst;
8243
- if (MSSA)
8244
- if (auto *Access = MSSA->getMemoryAccess (LastScheduledInst))
8245
- MemInsertPt = Access;
8246
8177
}
8247
8178
8248
8179
BS->schedule (picked, ReadyInsts);
@@ -8588,7 +8519,7 @@ struct SLPVectorizer : public FunctionPass {
8588
8519
auto *DB = &getAnalysis<DemandedBitsWrapperPass>().getDemandedBits ();
8589
8520
auto *ORE = &getAnalysis<OptimizationRemarkEmitterWrapperPass>().getORE ();
8590
8521
8591
- return Impl.runImpl (F, SE, TTI, TLI, AA, LI, DT, AC, DB, /* MSSA */ nullptr , ORE);
8522
+ return Impl.runImpl (F, SE, TTI, TLI, AA, LI, DT, AC, DB, ORE);
8592
8523
}
8593
8524
8594
8525
void getAnalysisUsage (AnalysisUsage &AU) const override {
@@ -8622,21 +8553,13 @@ PreservedAnalyses SLPVectorizerPass::run(Function &F, FunctionAnalysisManager &A
8622
8553
auto *AC = &AM.getResult <AssumptionAnalysis>(F);
8623
8554
auto *DB = &AM.getResult <DemandedBitsAnalysis>(F);
8624
8555
auto *ORE = &AM.getResult <OptimizationRemarkEmitterAnalysis>(F);
8625
- auto *MSSA = EnableMSSAInSLPVectorizer ?
8626
- &AM.getResult <MemorySSAAnalysis>(F).getMSSA () : (MemorySSA*)nullptr ;
8627
8556
8628
- bool Changed = runImpl (F, SE, TTI, TLI, AA, LI, DT, AC, DB, MSSA, ORE);
8557
+ bool Changed = runImpl (F, SE, TTI, TLI, AA, LI, DT, AC, DB, ORE);
8629
8558
if (!Changed)
8630
8559
return PreservedAnalyses::all ();
8631
8560
8632
8561
PreservedAnalyses PA;
8633
8562
PA.preserveSet <CFGAnalyses>();
8634
- if (MSSA) {
8635
- #ifdef EXPENSIVE_CHECKS
8636
- MSSA->verifyMemorySSA ();
8637
- #endif
8638
- PA.preserve <MemorySSAAnalysis>();
8639
- }
8640
8563
return PA;
8641
8564
}
8642
8565
@@ -8645,7 +8568,6 @@ bool SLPVectorizerPass::runImpl(Function &F, ScalarEvolution *SE_,
8645
8568
TargetLibraryInfo *TLI_, AAResults *AA_,
8646
8569
LoopInfo *LI_, DominatorTree *DT_,
8647
8570
AssumptionCache *AC_, DemandedBits *DB_,
8648
- MemorySSA *MSSA,
8649
8571
OptimizationRemarkEmitter *ORE_) {
8650
8572
if (!RunSLPVectorization)
8651
8573
return false ;
@@ -8679,7 +8601,7 @@ bool SLPVectorizerPass::runImpl(Function &F, ScalarEvolution *SE_,
8679
8601
8680
8602
// Use the bottom up slp vectorizer to construct chains that start with
8681
8603
// store instructions.
8682
- BoUpSLP R (&F, SE, TTI, TLI, AA, LI, DT, AC, DB, MSSA, DL, ORE_);
8604
+ BoUpSLP R (&F, SE, TTI, TLI, AA, LI, DT, AC, DB, DL, ORE_);
8683
8605
8684
8606
// A general note: the vectorizer must use BoUpSLP::eraseInstruction() to
8685
8607
// delete instructions.
0 commit comments