mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-25 17:20:48 +00:00
Add functions for finding ephemeral values
This adds a set of utility functions for collecting 'ephemeral' values. These are LLVM IR values that are used only by @llvm.assume intrinsics (directly or indirectly), and thus will be removed prior to code generation, implying that they should be considered free for certain purposes (like inlining). The inliner's cost analysis, and a few other passes, have been updated to account for ephemeral values using the provided functionality. This functionality is important for the usability of @llvm.assume, because it limits the "non-local" side-effects of adding llvm.assume on inlining, loop unrolling, etc. (these are hints, and do not generate code, so they should not directly contribute to estimates of execution cost). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217335 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -203,11 +203,15 @@ Pass *llvm::createSimpleLoopUnrollPass() {
|
||||
/// ApproximateLoopSize - Approximate the size of the loop.
|
||||
static unsigned ApproximateLoopSize(const Loop *L, unsigned &NumCalls,
|
||||
bool &NotDuplicatable,
|
||||
const TargetTransformInfo &TTI) {
|
||||
const TargetTransformInfo &TTI,
|
||||
AssumptionTracker *AT) {
|
||||
SmallPtrSet<const Value *, 32> EphValues;
|
||||
CodeMetrics::collectEphemeralValues(L, AT, EphValues);
|
||||
|
||||
CodeMetrics Metrics;
|
||||
for (Loop::block_iterator I = L->block_begin(), E = L->block_end();
|
||||
I != E; ++I)
|
||||
Metrics.analyzeBasicBlock(*I, TTI);
|
||||
Metrics.analyzeBasicBlock(*I, TTI, EphValues);
|
||||
NumCalls = Metrics.NumInlineCandidates;
|
||||
NotDuplicatable = Metrics.notDuplicatable;
|
||||
|
||||
@@ -391,7 +395,7 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
unsigned NumInlineCandidates;
|
||||
bool notDuplicatable;
|
||||
unsigned LoopSize =
|
||||
ApproximateLoopSize(L, NumInlineCandidates, notDuplicatable, TTI);
|
||||
ApproximateLoopSize(L, NumInlineCandidates, notDuplicatable, TTI, AT);
|
||||
DEBUG(dbgs() << " Loop Size = " << LoopSize << "\n");
|
||||
uint64_t UnrolledSize = (uint64_t)LoopSize * Count;
|
||||
if (notDuplicatable) {
|
||||
|
Reference in New Issue
Block a user