]> granicus.if.org Git - llvm/commitdiff
Add the missing hasLinkOnceODRLinkage predicate.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 30 Jul 2014 15:57:51 +0000 (15:57 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 30 Jul 2014 15:57:51 +0000 (15:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214312 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/GlobalValue.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/LTO/LTOModule.cpp
lib/Transforms/IPO/Inliner.cpp

index 68e410ba4b8baf628a582cc2eb53115d5f9b13b4..d42d0a9c39219ac7d549445e9e9b121e20655efa 100644 (file)
@@ -246,6 +246,7 @@ public:
   bool hasLinkOnceLinkage() const {
     return isLinkOnceLinkage(Linkage);
   }
+  bool hasLinkOnceODRLinkage() const { return isLinkOnceODRLinkage(Linkage); }
   bool hasWeakLinkage() const {
     return isWeakLinkage(Linkage);
   }
index 226e420422441060bcd4fdd8e91b7d6a7a088fbe..99179b6181b2285465213e6015030300b730e072 100644 (file)
@@ -253,8 +253,7 @@ bool AsmPrinter::doInitialization(Module &M) {
 }
 
 static bool canBeHidden(const GlobalValue *GV, const MCAsmInfo &MAI) {
-  GlobalValue::LinkageTypes Linkage = GV->getLinkage();
-  if (Linkage != GlobalValue::LinkOnceODRLinkage)
+  if (!GV->hasLinkOnceODRLinkage())
     return false;
 
   if (!MAI.hasWeakDefCanBeHiddenDirective())
index 3600baa5bbf1089c82f320b5cd3dbb60041e204b..1c8e36d743ed7a7a8f4e852e75813cf32e970a1f 100644 (file)
@@ -349,9 +349,7 @@ void LTOModule::addDefinedFunctionSymbol(const char *Name, const Function *F) {
 
 static bool canBeHidden(const GlobalValue *GV) {
   // FIXME: this is duplicated with another static function in AsmPrinter.cpp
-  GlobalValue::LinkageTypes L = GV->getLinkage();
-
-  if (L != GlobalValue::LinkOnceODRLinkage)
+  if (!GV->hasLinkOnceODRLinkage())
     return false;
 
   if (GV->hasUnnamedAddr())
index 9087ab23bb70ada46d3e23f96d1ab0465a795c97..a09387832df29b523ab886a165fb19553c4ef427 100644 (file)
@@ -357,8 +357,7 @@ bool Inliner::shouldInline(CallSite CS) {
   // FIXME: All of this logic should be sunk into getInlineCost. It relies on
   // the internal implementation of the inline cost metrics rather than
   // treating them as truly abstract units etc.
-  if (Caller->hasLocalLinkage() ||
-      Caller->getLinkage() == GlobalValue::LinkOnceODRLinkage) {
+  if (Caller->hasLocalLinkage() || Caller->hasLinkOnceODRLinkage()) {
     int TotalSecondaryCost = 0;
     // The candidate cost to be imposed upon the current function.
     int CandidateCost = IC.getCost() - (InlineConstants::CallPenalty + 1);