[PATCH] D21274: [Bugpoint] Erase comdat annotations after removing a global's initializer.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 13 09:21:48 PDT 2016


jlebar updated this revision to Diff 60544.
jlebar added a comment.

Also delete comdats when turning function defs into decls.


http://reviews.llvm.org/D21274

Files:
  tools/bugpoint/CrashDebugger.cpp
  tools/bugpoint/ExtractFunction.cpp

Index: tools/bugpoint/ExtractFunction.cpp
===================================================================
--- tools/bugpoint/ExtractFunction.cpp
+++ tools/bugpoint/ExtractFunction.cpp
@@ -215,6 +215,8 @@
 //
 void llvm::DeleteFunctionBody(Function *F) {
   eliminateAliases(F);
+  // Function declarations can't have comdats.
+  F->setComdat(nullptr);
 
   // delete the body of the function...
   F->deleteBody();
Index: tools/bugpoint/CrashDebugger.cpp
===================================================================
--- tools/bugpoint/CrashDebugger.cpp
+++ tools/bugpoint/CrashDebugger.cpp
@@ -164,6 +164,7 @@
     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 @@
       if (I->hasInitializer()) {
         DeleteGlobalInitializer(&*I);
         I->setLinkage(GlobalValue::ExternalLinkage);
+        I->setComdat(nullptr);
         DeletedInit = true;
       }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21274.60544.patch
Type: text/x-patch
Size: 1059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160613/f1b92345/attachment.bin>


More information about the llvm-commits mailing list