diff options
| author | Justin Lebar <jlebar@google.com> | 2016-06-15 23:20:12 +0000 |
|---|---|---|
| committer | Justin Lebar <jlebar@google.com> | 2016-06-15 23:20:12 +0000 |
| commit | 2a445cf736eeb03db9e51c7ff73616bb10c62448 (patch) | |
| tree | 4f6841bfd45a848dcb1a69bcf89caaee7612e558 | |
| parent | aac94b1e2e1ee2ab16fe471d35d1e947420497dc (diff) | |
| download | bcm5719-llvm-2a445cf736eeb03db9e51c7ff73616bb10c62448.tar.gz bcm5719-llvm-2a445cf736eeb03db9e51c7ff73616bb10c62448.zip | |
[Bugpoint] Erase comdat annotations after removing a global's initializer.
Summary:
This is necessary to keep the verifier happy after bugpoint removes an
initializer from a global variable with a comdat annotation, because
globals without initializers may not have comdats.
Reviewers: majnemer, rnk
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D21274
llvm-svn: 272854
| -rw-r--r-- | llvm/tools/bugpoint/CrashDebugger.cpp | 2 | ||||
| -rw-r--r-- | llvm/tools/bugpoint/ExtractFunction.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp index b161d88882a..02e488ed3da 100644 --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/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/llvm/tools/bugpoint/ExtractFunction.cpp b/llvm/tools/bugpoint/ExtractFunction.cpp index fe0ab69dc16..ae202c3f77e 100644 --- a/llvm/tools/bugpoint/ExtractFunction.cpp +++ b/llvm/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(); |

