Implement the isSafeToDiscardIfUnused predicate and use it in globalopt and
[oota-llvm.git] / lib / Transforms / IPO / GlobalOpt.cpp
index d316d526785e8c20bd6ca81eba2e7163db323a3a..9e3b8c28269f86cd9131dbc87d68f93cb15caa94 100644 (file)
@@ -1716,7 +1716,7 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
 /// possible.  If we make a change, return true.
 bool GlobalOpt::ProcessGlobal(GlobalVariable *GV,
                               Module::global_iterator &GVI) {
-  if (!GV->hasLocalLinkage())
+  if (!GV->isDiscardableIfUnused())
     return false;
 
   // Do more involved optimizations if the global is internal.