diff options
| author | Andrew Trick <atrick@apple.com> | 2011-10-01 01:39:05 +0000 |
|---|---|---|
| committer | Andrew Trick <atrick@apple.com> | 2011-10-01 01:39:05 +0000 |
| commit | f7656015fcfc49651a77699f41a4bd72883e2421 (patch) | |
| tree | a565b19877007e32c95088931269fb3892f71560 /llvm/lib/Transforms/IPO | |
| parent | cfebbcfedd2d56a06be473ec2ce25a0b11ce4ff0 (diff) | |
| download | bcm5719-llvm-f7656015fcfc49651a77699f41a4bd72883e2421.tar.gz bcm5719-llvm-f7656015fcfc49651a77699f41a4bd72883e2421.zip | |
Inlining and unrolling heuristics should be aware of free truncs.
We want heuristics to be based on accurate data, but more importantly
we don't want llvm to behave randomly. A benign trunc inserted by an
upstream pass should not cause a wild swings in optimization
level. See PR11034. It's a general problem with threshold-based
heuristics, but we can make it less bad.
llvm-svn: 140919
Diffstat (limited to 'llvm/lib/Transforms/IPO')
| -rw-r--r-- | llvm/lib/Transforms/IPO/InlineAlways.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/InlineSimple.cpp | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/InlineAlways.cpp b/llvm/lib/Transforms/IPO/InlineAlways.cpp index 50cccd51a06..c0426da2c68 100644 --- a/llvm/lib/Transforms/IPO/InlineAlways.cpp +++ b/llvm/lib/Transforms/IPO/InlineAlways.cpp @@ -23,6 +23,7 @@ #include "llvm/Support/CallSite.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO/InlinerPass.h" +#include "llvm/Target/TargetData.h" #include "llvm/ADT/SmallPtrSet.h" using namespace llvm; @@ -74,6 +75,8 @@ Pass *llvm::createAlwaysInlinerPass() { return new AlwaysInliner(); } // doInitialization - Initializes the vector of functions that have not // been annotated with the "always inline" attribute. bool AlwaysInliner::doInitialization(CallGraph &CG) { + CA.setTargetData(getAnalysisIfAvailable<TargetData>()); + Module &M = CG.getModule(); for (Module::iterator I = M.begin(), E = M.end(); diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp index 1ebe7c97e0b..84dd4fdd988 100644 --- a/llvm/lib/Transforms/IPO/InlineSimple.cpp +++ b/llvm/lib/Transforms/IPO/InlineSimple.cpp @@ -22,6 +22,7 @@ #include "llvm/Support/CallSite.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO/InlinerPass.h" +#include "llvm/Target/TargetData.h" #include "llvm/ADT/SmallPtrSet.h" using namespace llvm; @@ -75,6 +76,7 @@ Pass *llvm::createFunctionInliningPass(int Threshold) { // doInitialization - Initializes the vector of functions that have been // annotated with the noinline attribute. bool SimpleInliner::doInitialization(CallGraph &CG) { + CA.setTargetData(getAnalysisIfAvailable<TargetData>()); Module &M = CG.getModule(); |

