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