summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2016-11-17 01:17:02 +0000
committerDehao Chen <dehao@google.com>2016-11-17 01:17:02 +0000
commit41d72a8632605ad9366b9bfcd12fe80a177b80ca (patch)
tree8c52313d46859c2c91ec359ae6d57836f7e70379 /llvm/include
parent9103036f5ffadf7a881e8dca42ff862570d1e79f (diff)
downloadbcm5719-llvm-41d72a8632605ad9366b9bfcd12fe80a177b80ca.tar.gz
bcm5719-llvm-41d72a8632605ad9366b9bfcd12fe80a177b80ca.zip
Use profile info to adjust loop unroll threshold.
Summary: For flat loop, even if it is hot, it is not a good idea to unroll in runtime, thus we set a lower partial unroll threshold. For hot loop, we set a higher unroll threshold and allows expensive tripcount computation to allow more aggressive unrolling. Reviewers: davidxl, mzolotukhin Subscribers: sanjoy, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D26527 llvm-svn: 287186
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Transforms/Utils/LoopUtils.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
index 9c41475f352..307fb424b5e 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
@@ -461,6 +461,11 @@ Optional<const MDOperand *> findStringMetadataForLoop(Loop *TheLoop,
void addStringMetadataToLoop(Loop *TheLoop, const char *MDString,
unsigned V = 0);
+/// \brief Get a loop's estimated trip count based on branch weight metadata.
+/// Returns 0 when the count is estimated to be 0, or None when a meaningful
+/// estimate can not be made.
+Optional<unsigned> getLoopEstimatedTripCount(Loop *L);
+
/// Helper to consistently add the set of standard passes to a loop pass's \c
/// AnalysisUsage.
///
OpenPOWER on IntegriCloud