diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-20 23:33:15 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-20 23:33:15 +0000 |
commit | 64f2f910bd48c123a6b5945ebe90b018f7bea4d5 (patch) | |
tree | 22a781d2a92c90dc68f3fa31df2ea7ff47d1835d /lib/Transforms | |
parent | c5b8b590ee43d05816bf94ae54c77cb6275b98e4 (diff) |
Don't crash when llvm.compiler.used becomes empty.
GlobalOpt simplifies llvm.compiler.used by removing any members that are also
in the more strict llvm.used. Handle the special case where llvm.compiler.used
becomes empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186778 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 669162cb3d8..183a599bc12 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()); |