diff options
author | Nadav Rotem <nrotem@apple.com> | 2012-10-31 03:31:07 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2012-10-31 03:31:07 +0000 |
commit | ce77ab0c2457389d083a21d498b9ae16dab5dc05 (patch) | |
tree | 824bf848fc21483a8520dbcb5c3e9cc76303db98 /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | |
parent | fbc567ed0527a0664c4f7b97ee04704e9ab608a2 (diff) | |
download | bcm5719-llvm-ce77ab0c2457389d083a21d498b9ae16dab5dc05.tar.gz bcm5719-llvm-ce77ab0c2457389d083a21d498b9ae16dab5dc05.zip |
LoopVectorize: Do not vectorize loops with tiny constant trip counts.
llvm-svn: 167101
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index e82dfa2454f..fd728bd6168 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -1145,6 +1145,14 @@ bool LoopVectorizationLegality::canVectorize() { return false; } + // Do not loop-vectorize loops with a tiny trip count. + unsigned TC = SE->getSmallConstantTripCount(TheLoop, BB); + if (TC > 0 && TC < 16) { + DEBUG(dbgs() << "LV: Found a loop with a very small trip count. " << + "This loop is not worth vectorizing.\n"); + return false; + } + DEBUG(dbgs() << "LV: We can vectorize this loop!\n"); // Okay! We can vectorize. At this point we don't have any other mem analysis |