summaryrefslogtreecommitdiff
path: root/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
commitb2ab2fa524f3f90376639037bd81924483cca0af (patch)
treee09aa034342e5ed6e61cd2b7bb363b5808c9fc1b /lib/Transforms/IPO/InlineSimple.cpp
parent5c655413cf9466c29e38204ab3f19b33fffd7996 (diff)
downloadllvm-b2ab2fa524f3f90376639037bd81924483cca0af.tar.gz
llvm-b2ab2fa524f3f90376639037bd81924483cca0af.tar.bz2
llvm-b2ab2fa524f3f90376639037bd81924483cca0af.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140919 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/InlineSimple.cpp')
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 1ebe7c97e0..84dd4fdd98 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/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();