Let the -inline-threshold command line argument take precedence over the
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 2 Nov 2010 23:40:26 +0000 (23:40 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 2 Nov 2010 23:40:26 +0000 (23:40 +0000)
threshold given to createFunctionInliningPass().

Both opt -O3 and clang would silently ignore the -inline-threshold option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118117 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Transforms/IPO.h
lib/Transforms/IPO/Inliner.cpp

index 0de100348d0fc0817a1b9acceca6770bafe1a738..40ef9bbbd6403f0ff125943aee0359544f08a032 100644 (file)
@@ -99,6 +99,8 @@ ModulePass *createGVExtractionPass(std::vector<GlobalValue*>& GVs, bool
 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
 /// to inline direct function calls to small functions.
 ///
+/// The -inline-threshold command line option takes precedence over the
+/// threshold given here.
 Pass *createFunctionInliningPass();
 Pass *createFunctionInliningPass(int Threshold);
 
index 4983e8e13a3ee72aa87c4cd95facaf82494213f1..55f2815461a23aede118c36257e290de73fc243e 100644 (file)
@@ -52,7 +52,8 @@ Inliner::Inliner(char &ID)
   : CallGraphSCCPass(ID), InlineThreshold(InlineLimit) {}
 
 Inliner::Inliner(char &ID, int Threshold) 
-  : CallGraphSCCPass(ID), InlineThreshold(Threshold) {}
+  : CallGraphSCCPass(ID), InlineThreshold(InlineLimit.getNumOccurrences() > 0 ?
+                                          InlineLimit : Threshold) {}
 
 /// getAnalysisUsage - For this class, we declare that we require and preserve
 /// the call graph.  If the derived class implements this method, it should