From ec3ab49dda1767bc8b2b8744685c573758dff547 Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Wed, 31 Oct 2012 16:22:16 +0000 Subject: Put the threshold magic number in a variable. llvm-svn: 167134 --- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp') diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 40235ef1043..94e56a17131 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -75,6 +75,9 @@ static cl::opt VectorizationFactor("force-vector-width", cl::init(0), cl::Hidden, cl::desc("Set the default vectorization width. Zero is autoselect.")); +/// We don't vectorize loops with a known constant trip count below this number. +const int TinyTripCountThreshold = 16; + namespace { // Forward declarations. @@ -1147,7 +1150,7 @@ bool LoopVectorizationLegality::canVectorize() { // Do not loop-vectorize loops with a tiny trip count. unsigned TC = SE->getSmallConstantTripCount(TheLoop, BB); - if (TC > 0 && TC < 16) { + if (TC > 0 && TC < TinyTripCountThreshold) { DEBUG(dbgs() << "LV: Found a loop with a very small trip count. " << "This loop is not worth vectorizing.\n"); return false; -- cgit v1.2.3