@@ -893,30 +893,29 @@ struct DSEState {
893
893
// / basic block.
894
894
DenseMap<BasicBlock *, InstOverlapIntervalsTy> IOLs;
895
895
896
+ // Class contains self-reference, make sure it's not copied/moved.
897
+ DSEState (const DSEState &) = delete ;
898
+ DSEState &operator =(const DSEState &) = delete ;
899
+
896
900
DSEState (Function &F, AliasAnalysis &AA, MemorySSA &MSSA, DominatorTree &DT,
897
901
PostDominatorTree &PDT, const TargetLibraryInfo &TLI,
898
902
const LoopInfo &LI)
899
903
: F(F), AA(AA), EI(DT, LI), BatchAA(AA, &EI), MSSA(MSSA), DT(DT),
900
- PDT (PDT), TLI(TLI), DL(F.getParent()->getDataLayout()), LI(LI) {}
901
-
902
- static DSEState get (Function &F, AliasAnalysis &AA, MemorySSA &MSSA,
903
- DominatorTree &DT, PostDominatorTree &PDT,
904
- const TargetLibraryInfo &TLI, const LoopInfo &LI) {
905
- DSEState State (F, AA, MSSA, DT, PDT, TLI, LI);
904
+ PDT (PDT), TLI(TLI), DL(F.getParent()->getDataLayout()), LI(LI) {
906
905
// Collect blocks with throwing instructions not modeled in MemorySSA and
907
906
// alloc-like objects.
908
907
unsigned PO = 0 ;
909
908
for (BasicBlock *BB : post_order (&F)) {
910
- State. PostOrderNumbers [BB] = PO++;
909
+ PostOrderNumbers[BB] = PO++;
911
910
for (Instruction &I : *BB) {
912
911
MemoryAccess *MA = MSSA.getMemoryAccess (&I);
913
912
if (I.mayThrow () && !MA)
914
- State. ThrowingBlocks .insert (I.getParent ());
913
+ ThrowingBlocks.insert (I.getParent ());
915
914
916
915
auto *MD = dyn_cast_or_null<MemoryDef>(MA);
917
- if (MD && State. MemDefs .size () < MemorySSADefsPerBlockLimit &&
918
- (State. getLocForWriteEx (&I) || State. isMemTerminatorInst (&I)))
919
- State. MemDefs .push_back (MD);
916
+ if (MD && MemDefs.size () < MemorySSADefsPerBlockLimit &&
917
+ (getLocForWriteEx (&I) || isMemTerminatorInst (&I)))
918
+ MemDefs.push_back (MD);
920
919
}
921
920
}
922
921
@@ -926,14 +925,12 @@ struct DSEState {
926
925
if (AI.hasPassPointeeByValueCopyAttr ()) {
927
926
// For byval, the caller doesn't know the address of the allocation.
928
927
if (AI.hasByValAttr ())
929
- State. InvisibleToCallerBeforeRet .insert ({&AI, true });
930
- State. InvisibleToCallerAfterRet .insert ({&AI, true });
928
+ InvisibleToCallerBeforeRet.insert ({&AI, true });
929
+ InvisibleToCallerAfterRet.insert ({&AI, true });
931
930
}
932
931
933
932
// Collect whether there is any irreducible control flow in the function.
934
- State.ContainsIrreducibleLoops = mayContainIrreducibleControl (F, &LI);
935
-
936
- return State;
933
+ ContainsIrreducibleLoops = mayContainIrreducibleControl (F, &LI);
937
934
}
938
935
939
936
// / Return 'OW_Complete' if a store to the 'Later' location (by \p LaterI
@@ -1886,7 +1883,7 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA,
1886
1883
const LoopInfo &LI) {
1887
1884
bool MadeChange = false ;
1888
1885
1889
- DSEState State = DSEState::get (F, AA, MSSA, DT, PDT, TLI, LI);
1886
+ DSEState State (F, AA, MSSA, DT, PDT, TLI, LI);
1890
1887
// For each store:
1891
1888
for (unsigned I = 0 ; I < State.MemDefs .size (); I++) {
1892
1889
MemoryDef *KillingDef = State.MemDefs [I];
0 commit comments