[PATCH] D95817: NFC: Migrate LoopUnrollPass to work on InstructionCost
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 4 06:06:10 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG75b2555d6ef4: NFC: Migrate LoopUnrollPass to work on InstructionCost (authored by sdesmalen).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95817/new/
https://reviews.llvm.org/D95817
Files:
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
Index: llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -361,14 +361,14 @@
// 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;
+ InstructionCost 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;
+ InstructionCost RolledDynamicCost = 0;
// We track the simplification of each instruction in each iteration. We use
// this to recursively merge costs into the unrolled cost on-demand so that
@@ -639,10 +639,15 @@
}
}
+ assert(UnrolledCost.isValid() && RolledDynamicCost.isValid() &&
+ "All instructions must have a valid cost, whether the "
+ "loop is rolled or unrolled.");
+
LLVM_DEBUG(dbgs() << "Analysis finished:\n"
<< "UnrolledCost: " << UnrolledCost << ", "
<< "RolledDynamicCost: " << RolledDynamicCost << "\n");
- return {{UnrolledCost, RolledDynamicCost}};
+ return {{unsigned(*UnrolledCost.getValue()),
+ unsigned(*RolledDynamicCost.getValue())}};
}
/// ApproximateLoopSize - Approximate the size of the loop.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95817.321402.patch
Type: text/x-patch
Size: 1650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210204/d1e9e74e/attachment.bin>
More information about the llvm-commits
mailing list