Some optimizations done by globalopt are safe only for internal linkage, not

linkonce linkage. For example, it is not valid to add unnamed_addr.

This also fixes a crash in g++.dg/opt/static5.C.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158528 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2012-06-15 18:00:24 +00:00
parent d628a587b6
commit 2f135d4c14
2 changed files with 15 additions and 0 deletions

View File

@@ -1729,6 +1729,9 @@ bool GlobalOpt::ProcessGlobal(GlobalVariable *GV,
return true;
}
if (!GV->hasLocalLinkage())
return false;
SmallPtrSet<const PHINode*, 16> PHIUsers;
GlobalStatus GS;