aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO/GlobalOpt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 669162c..183a599 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -3070,6 +3070,11 @@ static int compareNames(const void *A, const void *B) {
static void setUsedInitializer(GlobalVariable &V,
SmallPtrSet<GlobalValue *, 8> Init) {
+ if (Init.empty()) {
+ V.eraseFromParent();
+ return;
+ }
+
SmallVector<llvm::Constant *, 8> UsedArray;
PointerType *Int8PtrTy = Type::getInt8PtrTy(V.getContext());