If the global variable is removed by the linker, then don't constant merge it
[oota-llvm.git] / include / llvm / GlobalValue.h
index 81a11a4c9258c7e832ebe31e7431d5f0e12a43d4..d43a2fa227c65c08e1e7f4cfba70224fc13be54c 100644 (file)
@@ -192,6 +192,14 @@ public:
            Linkage == LinkerPrivateWeakDefAutoLinkage;
   }
 
+  /// mayBeRemovedByLinker - Whether the definition of this global may be
+  /// removed at link time.
+  static bool mayBeRemovedByLinker(LinkageTypes Linkage) {
+    return isLinkerPrivateLinkage(Linkage) ||
+      isLinkerPrivateWeakLinkage(Linkage) ||
+      isLinkerPrivateWeakDefAutoLinkage(Linkage);
+  }
+
   bool hasExternalLinkage() const { return isExternalLinkage(Linkage); }
   bool hasAvailableExternallyLinkage() const {
     return isAvailableExternallyLinkage(Linkage);
@@ -225,6 +233,8 @@ public:
 
   bool isWeakForLinker() const { return isWeakForLinker(Linkage); }
 
+  bool mayBeRemovedByLinker() const { return mayBeRemovedByLinker(Linkage); }
+
   /// copyAttributesFrom - copy all additional attributes (those not needed to
   /// create a GlobalValue) from the GlobalValue Src to this one.
   virtual void copyAttributesFrom(const GlobalValue *Src);