[llvm] r244095 - [Unroll] Switch to using 'int' cost types in preparation for a somewhat
Chandler Carruth
chandlerc at gmail.com
Wed Aug 5 11:46:21 PDT 2015
Author: chandlerc
Date: Wed Aug 5 13:46:21 2015
New Revision: 244095
URL: http://llvm.org/viewvc/llvm-project?rev=244095&view=rev
Log:
[Unroll] Switch to using 'int' cost types in preparation for a somewhat
more involved change to the cost computation pattern.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=244095&r1=244094&r2=244095&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Wed Aug 5 13:46:21 2015
@@ -497,11 +497,11 @@ private:
namespace {
struct EstimatedUnrollCost {
/// \brief The estimated cost after unrolling.
- unsigned UnrolledCost;
+ int UnrolledCost;
/// \brief The estimated dynamic cost of executing the instructions in the
/// rolled form.
- unsigned RolledDynamicCost;
+ int RolledDynamicCost;
};
}
@@ -521,7 +521,7 @@ struct EstimatedUnrollCost {
Optional<EstimatedUnrollCost>
analyzeLoopUnrollCost(const Loop *L, unsigned TripCount, DominatorTree &DT,
ScalarEvolution &SE, const TargetTransformInfo &TTI,
- unsigned MaxUnrolledLoopSize) {
+ int MaxUnrolledLoopSize) {
// We want to be able to scale offsets by the trip count and add more offsets
// to them without checking for overflows, and we already don't want to
// analyze *massive* trip counts, so we force the max to be reasonably small.
@@ -539,13 +539,13 @@ analyzeLoopUnrollCost(const Loop *L, uns
// The estimated cost of the unrolled form of the loop. We try to estimate
// this by simplifying as much as we can while computing the estimate.
- unsigned UnrolledCost = 0;
+ int UnrolledCost = 0;
// We also track the estimated dynamic (that is, actually executed) cost in
// the rolled form. This helps identify cases when the savings from unrolling
// aren't just exposing dead control flows, but actual reduced dynamic
// instructions due to the simplifications which we expect to occur after
// unrolling.
- unsigned RolledDynamicCost = 0;
+ int RolledDynamicCost = 0;
// Ensure that we don't violate the loop structure invariants relied on by
// this analysis.
@@ -601,7 +601,7 @@ analyzeLoopUnrollCost(const Loop *L, uns
// it. We don't change the actual IR, just count optimization
// opportunities.
for (Instruction &I : *BB) {
- unsigned InstCost = TTI.getUserCost(&I);
+ int InstCost = TTI.getUserCost(&I);
// Visit the instruction to analyze its loop cost after unrolling,
// and if the visitor returns false, include this instruction in the
More information about the llvm-commits
mailing list