aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Analysis/InlineCost.h16
-rw-r--r--include/llvm/Value.h8
2 files changed, 20 insertions, 4 deletions
diff --git a/include/llvm/Analysis/InlineCost.h b/include/llvm/Analysis/InlineCost.h
index e3d526e..f8bb18d 100644
--- a/include/llvm/Analysis/InlineCost.h
+++ b/include/llvm/Analysis/InlineCost.h
@@ -110,6 +110,10 @@ namespace llvm {
/// entry here.
std::vector<ArgInfo> ArgumentWeights;
+ /// PointerArgPairWeights - Weights to use when giving an inline bonus to
+ /// a call site due to correlated pairs of pointers.
+ DenseMap<std::pair<unsigned, unsigned>, unsigned> PointerArgPairWeights;
+
/// countCodeReductionForConstant - Figure out an approximation for how
/// many instructions will be constant folded if the specified value is
/// constant.
@@ -122,6 +126,18 @@ namespace llvm {
unsigned countCodeReductionForAlloca(const CodeMetrics &Metrics,
Value *V);
+ /// countCodeReductionForPointerPair - Count the bonus to apply to an
+ /// inline call site where a pair of arguments are pointers and one
+ /// argument is a constant offset from the other. The idea is to
+ /// recognize a common C++ idiom where a begin and end iterator are
+ /// actually pointers, and many operations on the pair of them will be
+ /// constants if the function is called with arguments that have
+ /// a constant offset.
+ void countCodeReductionForPointerPair(
+ const CodeMetrics &Metrics,
+ DenseMap<Value *, unsigned> &PointerArgs,
+ Value *V, unsigned ArgIdx);
+
/// analyzeFunction - Add information about the specified function
/// to the current structure.
void analyzeFunction(Function *F, const TargetData *TD);
diff --git a/include/llvm/Value.h b/include/llvm/Value.h
index 9896bc7..380af0b 100644
--- a/include/llvm/Value.h
+++ b/include/llvm/Value.h
@@ -271,13 +271,13 @@ public:
return const_cast<Value*>(this)->stripPointerCasts();
}
- /// stripConstantOffsets - This method strips off unneeded pointer casts and
+ /// stripInBoundsConstantOffsets - This method strips off unneeded pointer casts and
/// all-constant GEPs from the specified value, returning the original
/// pointer value. If this is called on a non-pointer value, it returns
/// 'this'.
- Value *stripConstantOffsets();
- const Value *stripConstantOffsets() const {
- return const_cast<Value*>(this)->stripConstantOffsets();
+ Value *stripInBoundsConstantOffsets();
+ const Value *stripInBoundsConstantOffsets() const {
+ return const_cast<Value*>(this)->stripInBoundsConstantOffsets();
}
/// stripInBoundsOffsets - This method strips off unneeded pointer casts and