[bugpoint] Also remove comdat's from externalized GVs
authorHal Finkel <hfinkel@anl.gov>
Tue, 11 Apr 2017 00:18:42 +0000 (00:18 +0000)
committerHal Finkel <hfinkel@anl.gov>
Tue, 11 Apr 2017 00:18:42 +0000 (00:18 +0000)
We were removing comdats from externalized functions (function declarations
can't be comdat), but were not doing the same for variable. Failure to do this
would cause bugpoint to fail ("Declaration may not be in a Comdat!").

llvm-svn: 299908

llvm/tools/bugpoint/ExtractFunction.cpp

index d57613ec5e37688f6a744e4ec3e5be2b9f651220..82c61b6e1be7aa52a76750c82b4cbbc9ea378e1d 100644 (file)
@@ -209,6 +209,7 @@ static void eliminateAliases(GlobalValue *GV) {
 void llvm::DeleteGlobalInitializer(GlobalVariable *GV) {
   eliminateAliases(GV);
   GV->setInitializer(nullptr);
+  GV->setComdat(nullptr);
 }
 
 // DeleteFunctionBody - "Remove" the function by deleting all of its basic