diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-04-24 20:07:38 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-04-24 20:07:38 +0000 |
| commit | 60430423c94805f0100122f0d49eaccf4c8c6f90 (patch) | |
| tree | 8ad2ad768eea0c26df431519aeef4f48c2a58afd /llvm | |
| parent | b052843bd2fc886de3424e2b2ddb5936452ce37d (diff) | |
| download | bcm5719-llvm-60430423c94805f0100122f0d49eaccf4c8c6f90.tar.gz bcm5719-llvm-60430423c94805f0100122f0d49eaccf4c8c6f90.zip | |
Fix a nasty bug where the ConstantMerge pass was invalidating the TargetData pass
even though it was immutable. Immutable passes should never end up in CurrentAnalyses!
llvm-svn: 5906
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/VMCore/PassManagerT.h | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/llvm/lib/VMCore/PassManagerT.h b/llvm/lib/VMCore/PassManagerT.h index 123af346561..55beaa457a4 100644 --- a/llvm/lib/VMCore/PassManagerT.h +++ b/llvm/lib/VMCore/PassManagerT.h @@ -332,12 +332,32 @@ public: } } + Pass *getImmutablePassOrNull(const PassInfo *ID) const { + for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) { + const PassInfo *IPID = ImmutablePasses[i]->getPassInfo(); + if (IPID == ID) + return ImmutablePasses[i]; + + // This pass is the current implementation of all of the interfaces it + // implements as well. + // + const std::vector<const PassInfo*> &II = + IPID->getInterfacesImplemented(); + for (unsigned j = 0, e = II.size(); j != e; ++j) + if (II[j] == ID) return ImmutablePasses[i]; + } + return 0; + } + Pass *getAnalysisOrNullDown(const PassInfo *ID) const { std::map<AnalysisID, Pass*>::const_iterator I = CurrentAnalyses.find(ID); if (I != CurrentAnalyses.end()) return I->second; // Found it. + if (Pass *P = getImmutablePassOrNull(ID)) + return P; + if (Batcher) return ((AnalysisResolver*)Batcher)->getAnalysisOrNullDown(ID); return 0; @@ -350,6 +370,8 @@ public: if (Parent) // Try scanning... return Parent->getAnalysisOrNullUp(ID); + else if (!ImmutablePasses.empty()) + return getImmutablePassOrNull(ID); return 0; } @@ -386,7 +408,9 @@ public: if (Parent) { Parent->markPassUsed(P, this); } else { - assert(0 && "Pass available but not found! " + assert(getAnalysisOrNullUp(P) && + dynamic_cast<ImmutablePass*>(getAnalysisOrNullUp(P)) && + "Pass available but not found! " "Perhaps this is a module pass requiring a function pass?"); } } @@ -556,18 +580,6 @@ public: // Initialize the immutable pass... IP->initializePass(); - - // Add this pass to the currently available set... - if (const PassInfo *PI = IP->getPassInfo()) { - CurrentAnalyses[PI] = IP; - - // This pass is the current implementation of all of the interfaces it - // implements as well. - // - const std::vector<const PassInfo*> &II = PI->getInterfacesImplemented(); - for (unsigned i = 0, e = II.size(); i != e; ++i) - CurrentAnalyses[II[i]] = IP; - } } }; |

