@@ -114,10 +114,9 @@ void AliasSetTracker::removeAliasSet(AliasSet *AS) {
114
114
if (AliasSet *Fwd = AS->Forward ) {
115
115
Fwd->dropRef (*this );
116
116
AS->Forward = nullptr ;
117
- }
118
-
119
- if (AS->Alias == AliasSet::SetMayAlias)
120
- TotalMayAliasSetSize -= AS->size ();
117
+ } else // Update TotalMayAliasSetSize only if not forwarding.
118
+ if (AS->Alias == AliasSet::SetMayAlias)
119
+ TotalMayAliasSetSize -= AS->size ();
121
120
122
121
AliasSets.erase (AS);
123
122
}
@@ -232,8 +231,8 @@ bool AliasSet::aliasesUnknownInst(const Instruction *Inst,
232
231
if (AliasAny)
233
232
return true ;
234
233
235
- if (! Inst->mayReadOrWriteMemory ())
236
- return false ;
234
+ assert ( Inst->mayReadOrWriteMemory () &&
235
+ " Instruction must either read or write memory. " ) ;
237
236
238
237
for (unsigned i = 0 , e = UnknownInsts.size (); i != e; ++i) {
239
238
if (auto *UnknownInst = getUnknownInst (i)) {
@@ -311,13 +310,6 @@ AliasSet *AliasSetTracker::mergeAliasSetsForPointer(const Value *Ptr,
311
310
return FoundSet;
312
311
}
313
312
314
- bool AliasSetTracker::containsUnknown (const Instruction *Inst) const {
315
- for (const AliasSet &AS : *this )
316
- if (!AS.Forward && AS.aliasesUnknownInst (Inst, AA))
317
- return true ;
318
- return false ;
319
- }
320
-
321
313
AliasSet *AliasSetTracker::findAliasSetForUnknownInst (Instruction *Inst) {
322
314
AliasSet *FoundSet = nullptr ;
323
315
for (iterator I = begin (), E = end (); I != E;) {
@@ -326,7 +318,7 @@ AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) {
326
318
continue ;
327
319
if (!FoundSet) // If this is the first alias set ptr can go into.
328
320
FoundSet = &*Cur; // Remember it.
329
- else if (!Cur-> Forward ) // Otherwise, we must merge the sets.
321
+ else // Otherwise, we must merge the sets.
330
322
FoundSet->mergeSetIn (*Cur, *this ); // Merge in contents.
331
323
}
332
324
return FoundSet;
0 commit comments