summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/InlineSimple.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-10-01 01:39:05 +0000
committerAndrew Trick <atrick@apple.com>2011-10-01 01:39:05 +0000
commitf7656015fcfc49651a77699f41a4bd72883e2421 (patch)
treea565b19877007e32c95088931269fb3892f71560 /llvm/lib/Transforms/IPO/InlineSimple.cpp
parentcfebbcfedd2d56a06be473ec2ce25a0b11ce4ff0 (diff)
downloadbcm5719-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/InlineSimple.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/InlineSimple.cpp2
1 files changed, 2 insertions, 0 deletions
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();
OpenPOWER on IntegriCloud