Move assertion with TargetPassConfig's Initialized flag.
authorBob Wilson <bob.wilson@apple.com>
Mon, 2 Jul 2012 19:48:39 +0000 (19:48 +0000)
committerBob Wilson <bob.wilson@apple.com>
Mon, 2 Jul 2012 19:48:39 +0000 (19:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159569 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Passes.cpp

index c64843e2c184c50ddb4ccd54e77f194700b3e146..20a3ff45e850d45eb9fb9bf0f8f3f2bcb1950281 100644 (file)
@@ -273,14 +273,14 @@ AnalysisID TargetPassConfig::getPassSubstitution(AnalysisID ID) const {
 
 /// Add a pass to the PassManager.
 void TargetPassConfig::addPass(Pass *P) {
+  assert(!Initialized && "PassConfig is immutable");
+
   PM->add(P);
 }
 
 /// Add a CodeGen pass at this point in the pipeline after checking for target
 /// and command line overrides.
 AnalysisID TargetPassConfig::addPass(AnalysisID PassID) {
-  assert(!Initialized && "PassConfig is immutable");
-
   AnalysisID TargetID = getPassSubstitution(PassID);
   AnalysisID FinalID = overridePass(PassID, TargetID);
   if (FinalID == 0)