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
This commit is contained in:
Rafael Espindola
2013-07-20 23:33:15 +00:00
parent c5b8b590ee
commit 64f2f910bd
2 changed files with 21 additions and 0 deletions

View File

@@ -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());