diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2014-01-27 11:41:50 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2014-01-27 11:41:50 +0000 |
| commit | edfa37effa78781f7a0211196c8243aee38eaea6 (patch) | |
| tree | bd72b8c20d5575b6d7321179dac682ed8abb12f3 /llvm/lib/Transforms/Vectorize | |
| parent | 2bb03ba6050ef482652cb49105d1f2a6b066e97f (diff) | |
| download | bcm5719-llvm-edfa37effa78781f7a0211196c8243aee38eaea6.tar.gz bcm5719-llvm-edfa37effa78781f7a0211196c8243aee38eaea6.zip | |
[vectorizer] Add an override for the target instruction cost and use it
to stabilize a test that really is trying to test generic behavior and
not a specific target's behavior.
llvm-svn: 200215
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 1ba0b77503e..750fc40d261 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -160,6 +160,12 @@ static cl::opt<unsigned> ForceTargetMaxVectorUnrollFactor( cl::desc("A flag that overrides the target's max unroll factor for " "vectorized loops.")); +static cl::opt<unsigned> ForceTargetInstructionCost( + "force-target-instruction-cost", cl::init(0), cl::Hidden, + cl::desc("A flag that overrides the target's expected cost for " + "an instruction to a single constant value. Mostly " + "useful for getting consistent testing.")); + static cl::opt<unsigned> SmallLoopCost( "small-loop-cost", cl::init(20), cl::Hidden, cl::desc("The cost of a loop that is considered 'small' by the unroller.")); @@ -5185,6 +5191,11 @@ unsigned LoopVectorizationCostModel::expectedCost(unsigned VF) { continue; unsigned C = getInstructionCost(it, VF); + + // Check if we should override the cost. + if (ForceTargetInstructionCost.getNumOccurrences() > 0) + C = ForceTargetInstructionCost; + BlockCost += C; DEBUG(dbgs() << "LV: Found an estimated cost of " << C << " for VF " << VF << " For instruction: " << *it << '\n'); |

