File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
libclc/utils/libclc-remangler Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -968,6 +968,7 @@ class LibCLCRemangler : public ASTConsumer {
968968 void postProcessRemoveTmpSuffix (llvm::Module *M) {
969969 if (TestRun)
970970 return ;
971+ std::vector<Function *> ToErase;
971972 for (auto &F : make_early_inc_range (*M)) {
972973 StringRef Name = F.getName ();
973974 if (!Name.consume_back (TmpSuffix))
@@ -976,7 +977,7 @@ class LibCLCRemangler : public ASTConsumer {
976977 if (RenamedFunctions.count (Name.str ())) {
977978 // Drop unuseful clone of the original or remangled function.
978979 Func->replaceAllUsesWith (ConstantPointerNull::get (Func->getType ()));
979- Func-> eraseFromParent ( );
980+ ToErase. push_back (Func );
980981 } else {
981982 // Name doesn't exist in the original module. Drop unuseful clone of
982983 // remangled function.
@@ -987,6 +988,8 @@ class LibCLCRemangler : public ASTConsumer {
987988 // Complete the mangling process, e.g. from _Z1fPU3AS4i to _Z1fPi.
988989 F.setName (Name);
989990 }
991+ for (auto *F : ToErase)
992+ F->eraseFromParent ();
990993 }
991994
992995 void handleModule (llvm::Module *M) {
You can’t perform that action at this time.
0 commit comments