[g-arc-opts] Invert dependency in between RefCountState and its subclasses in clear() and call the subclass clear instead of the superclass clear.

Otherwise, we do not clear subclass specific state when we clear which can
potentially cause inconsistencies.

Swift SVN r20779
This commit is contained in:
Michael Gottesman
2014-07-30 21:47:31 +00:00
parent d1e45a1222
commit 5f98995c6c
2 changed files with 12 additions and 11 deletions

View File

@@ -242,7 +242,7 @@ bool TopDownRefCountState::merge(const TopDownRefCountState &Other) {
// elimination. If the branch predicates for the two merge differ, mixing
// them is unsafe since they are not control dependent.
if (LatState == TopDownRefCountState::LatticeState::None) {
RefCountState<TopDownRefCountState>::clear();
clear();
DEBUG(llvm::dbgs() << " Found LatticeState::None. "
"Clearing State!\n");
return false;
@@ -250,10 +250,10 @@ bool TopDownRefCountState::merge(const TopDownRefCountState &Other) {
// We should never have an argument path merge with a non-argument path.
if (Argument.isNull() != Other.Argument.isNull()) {
RefCountState<TopDownRefCountState>::clear();
DEBUG(llvm::dbgs() << " Can not merge Argument with "
"Non-Argument path... Bailing!\n");
return false;
clear();
DEBUG(llvm::dbgs() << " Can not merge Argument with "
"Non-Argument path... Bailing!\n");
return false;
}
Increments.insert(Other.Increments.begin(), Other.Increments.end());
@@ -292,7 +292,7 @@ bool BottomUpRefCountState::merge(const BottomUpRefCountState &Other) {
if (LatState == BottomUpRefCountState::LatticeState::None) {
DEBUG(llvm::dbgs() << " Found LatticeState::None. "
"Clearing State!\n");
RefCountState<BottomUpRefCountState>::clear();
clear();
return false;
}