From: Dan Gohman Date: Sun, 29 Aug 2010 16:39:22 +0000 (+0000) Subject: Optionally rerun dedicated-register filtering after applying X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=4f7e18dee35c55e4e719f5fb73726ab035a7e5db;p=oota-llvm.git Optionally rerun dedicated-register filtering after applying other filtering techniques, as those may allow it to filter out more obviously unprofitable candidates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112441 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 8a688063998..4fe93b9d415 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1391,6 +1391,7 @@ public: size_t EstimateSearchSpaceComplexity() const; void NarrowSearchSpaceByDetectingSupersets(); void NarrowSearchSpaceByCollapsingUnrolledCode(); + void NarrowSearchSpaceByRefilteringUndesirableDedicatedRegisters(); void NarrowSearchSpaceByPickingWinnerRegs(); void NarrowSearchSpaceUsingHeuristics(); @@ -3104,6 +3105,24 @@ void LSRInstance::NarrowSearchSpaceByCollapsingUnrolledCode() { } } +/// NarrowSearchSpaceByRefilteringUndesirableDedicatedRegisters - Call +/// FilterOutUndesirableDedicatedRegisters again, if necessary, now that +/// we've done more filtering, as it may be able to find more formulae to +/// eliminate. +void LSRInstance::NarrowSearchSpaceByRefilteringUndesirableDedicatedRegisters(){ + if (EstimateSearchSpaceComplexity() >= ComplexityLimit) { + DEBUG(dbgs() << "The search space is too complex.\n"); + + DEBUG(dbgs() << "Narrowing the search space by re-filtering out " + "undesirable dedicated registers.\n"); + + FilterOutUndesirableDedicatedRegisters(); + + DEBUG(dbgs() << "After pre-selection:\n"; + print_uses(dbgs())); + } +} + /// NarrowSearchSpaceByPickingWinnerRegs - Pick a register which seems likely /// to be profitable, and then in any use which has any reference to that /// register, delete all formulae which do not reference that register. @@ -3176,6 +3195,7 @@ void LSRInstance::NarrowSearchSpaceByPickingWinnerRegs() { void LSRInstance::NarrowSearchSpaceUsingHeuristics() { NarrowSearchSpaceByDetectingSupersets(); NarrowSearchSpaceByCollapsingUnrolledCode(); + NarrowSearchSpaceByRefilteringUndesirableDedicatedRegisters(); NarrowSearchSpaceByPickingWinnerRegs(); }