[llvm-extract] Drop comdats from declarations
[oota-llvm.git] / lib / Transforms / IPO / ExtractGV.cpp
index 2f8c7d9349b9ccae813789497edcd9313ebe9b61..b9462f2ffc722d118d1f466e49700a6f648f20e4 100644 (file)
@@ -93,8 +93,11 @@ namespace {
 
         makeVisible(*I, Delete);
 
-        if (Delete)
+        if (Delete) {
+          // Make this a declaration and drop it's comdat.
           I->setInitializer(nullptr);
+          I->setComdat(nullptr);
+        }
       }
 
       // Visit the Functions.
@@ -108,8 +111,11 @@ namespace {
 
         makeVisible(*I, Delete);
 
-        if (Delete)
+        if (Delete) {
+          // Make this a declaration and drop it's comdat.
           I->deleteBody();
+          I->setComdat(nullptr);
+        }
       }
 
       // Visit the Aliases.