diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index b161d88882a..02e488ed3da 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -164,6 +164,7 @@ ReduceCrashingGlobalVariables::TestGlobalVariables( if (I.hasInitializer() && !GVSet.count(&I)) { DeleteGlobalInitializer(&I); I.setLinkage(GlobalValue::ExternalLinkage); + I.setComdat(nullptr); } // Try running the hacked up program... @@ -668,6 +669,7 @@ static bool DebugACrash(BugDriver &BD, if (I->hasInitializer()) { DeleteGlobalInitializer(&*I); I->setLinkage(GlobalValue::ExternalLinkage); + I->setComdat(nullptr); DeletedInit = true; } diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index fe0ab69dc16..ae202c3f77e 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -215,6 +215,8 @@ void llvm::DeleteGlobalInitializer(GlobalVariable *GV) { // void llvm::DeleteFunctionBody(Function *F) { eliminateAliases(F); + // Function declarations can't have comdats. + F->setComdat(nullptr); // delete the body of the function... F->deleteBody();