Index: lib/IR/LegacyPassManager.cpp =================================================================== --- lib/IR/LegacyPassManager.cpp +++ lib/IR/LegacyPassManager.cpp @@ -1677,6 +1677,10 @@ // that we checked for an available analysis above. FPP->add(RequiredPass); } + else + { + delete RequiredPass; + } // Register P as the last user of FoundPass or RequiredPass. SmallVector LU; LU.push_back(FoundPass);