aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorAyal Zaks <ayal.zaks@intel.com>2020-06-07 11:36:57 +0300
committerAyal Zaks <ayal.zaks@intel.com>2020-07-07 15:04:21 +0300
commit7bf299c8d8d59304fb821f8811618cdeb1d1f1fd (patch)
tree2873472f5c0a581db47fab61f91331bca4953b97 /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parentde0175d04bc3679c7bd8dc64520e790bf38f30b0 (diff)
downloadllvm-7bf299c8d8d59304fb821f8811618cdeb1d1f1fd.zip
llvm-7bf299c8d8d59304fb821f8811618cdeb1d1f1fd.tar.gz
llvm-7bf299c8d8d59304fb821f8811618cdeb1d1f1fd.tar.bz2
[LV] Vectorize without versioning-for-unit-stride under -Os/-Oz
If a loop is in a function marked OptSize, Loop Access Analysis should refrain from generating runtime checks for unit strides that will version the loop. If a loop is in a function marked OptSize and its vectorization is enabled, it should be vectorized w/o any versioning. Fixes PR46228. Differential Revision: https://reviews.llvm.org/D81345
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 3c75f0f..ae282a7 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1835,6 +1835,10 @@ void LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
const bool IsAnnotatedParallel = TheLoop->isAnnotatedParallel();
+ const bool EnableMemAccessVersioningOfLoop =
+ EnableMemAccessVersioning &&
+ !TheLoop->getHeader()->getParent()->hasOptSize();
+
// For each block.
for (BasicBlock *BB : TheLoop->blocks()) {
// Scan the BB and collect legal loads and stores. Also detect any
@@ -1890,7 +1894,7 @@ void LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
NumLoads++;
Loads.push_back(Ld);
DepChecker->addAccess(Ld);
- if (EnableMemAccessVersioning)
+ if (EnableMemAccessVersioningOfLoop)
collectStridedAccess(Ld);
continue;
}
@@ -1914,7 +1918,7 @@ void LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
NumStores++;
Stores.push_back(St);
DepChecker->addAccess(St);
- if (EnableMemAccessVersioning)
+ if (EnableMemAccessVersioningOfLoop)
collectStridedAccess(St);
}
} // Next instr.