more involved change to the cost computation pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244095
91177308-0d34-0410-b5e6-
96231b3b80d8
namespace {
struct EstimatedUnrollCost {
/// \brief The estimated cost after unrolling.
namespace {
struct EstimatedUnrollCost {
/// \brief The estimated cost after unrolling.
/// \brief The estimated dynamic cost of executing the instructions in the
/// rolled form.
/// \brief The estimated dynamic cost of executing the instructions in the
/// rolled form.
- unsigned RolledDynamicCost;
Optional<EstimatedUnrollCost>
analyzeLoopUnrollCost(const Loop *L, unsigned TripCount, DominatorTree &DT,
ScalarEvolution &SE, const TargetTransformInfo &TTI,
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.
// 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.
// 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.
// 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;
// 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.
// 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.
// Ensure that we don't violate the loop structure invariants relied on by
// this analysis.
// it. We don't change the actual IR, just count optimization
// opportunities.
for (Instruction &I : *BB) {
// 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
// Visit the instruction to analyze its loop cost after unrolling,
// and if the visitor returns false, include this instruction in the