[llvm] r214312 - Add the missing hasLinkOnceODRLinkage predicate.

Rafael Espindola rafael.espindola at gmail.com
Wed Jul 30 08:57:51 PDT 2014


Author: rafael
Date: Wed Jul 30 10:57:51 2014
New Revision: 214312

URL: http://llvm.org/viewvc/llvm-project?rev=214312&view=rev
Log:
Add the missing hasLinkOnceODRLinkage predicate.

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

Modified: llvm/trunk/include/llvm/IR/GlobalValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/GlobalValue.h?rev=214312&r1=214311&r2=214312&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/GlobalValue.h (original)
+++ llvm/trunk/include/llvm/IR/GlobalValue.h Wed Jul 30 10:57:51 2014
@@ -246,6 +246,7 @@ public:
   bool hasLinkOnceLinkage() const {
     return isLinkOnceLinkage(Linkage);
   }
+  bool hasLinkOnceODRLinkage() const { return isLinkOnceODRLinkage(Linkage); }
   bool hasWeakLinkage() const {
     return isWeakLinkage(Linkage);
   }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=214312&r1=214311&r2=214312&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Jul 30 10:57:51 2014
@@ -253,8 +253,7 @@ bool AsmPrinter::doInitialization(Module
 }
 
 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())

Modified: llvm/trunk/lib/LTO/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOModule.cpp?rev=214312&r1=214311&r2=214312&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOModule.cpp (original)
+++ llvm/trunk/lib/LTO/LTOModule.cpp Wed Jul 30 10:57:51 2014
@@ -349,9 +349,7 @@ void LTOModule::addDefinedFunctionSymbol
 
 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())

Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=214312&r1=214311&r2=214312&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Wed Jul 30 10:57:51 2014
@@ -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);





More information about the llvm-commits mailing list