aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2020-05-10 13:27:10 +0100
committerFlorian Hahn <flo@fhahn.com>2020-05-10 13:28:00 +0100
commitfc44617f28847417e55836193bbe8e9c3f09eca9 (patch)
tree532ea415187a248ff797e4d8a8178c9916985899
parent11c4fc6c4844f9bea694b96b84ad07bde9d39e19 (diff)
downloadllvm-fc44617f28847417e55836193bbe8e9c3f09eca9.zip
llvm-fc44617f28847417e55836193bbe8e9c3f09eca9.tar.gz
llvm-fc44617f28847417e55836193bbe8e9c3f09eca9.tar.bz2
Revert "[LAA] Remove one addRuntimeChecks function (NFC)."
This reverts commit c28114c8ffde705d7e16cd4c065fd23269661c81. This causes some bots to fail: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/30596/steps/build%20android%2Faarch64/logs/stdio
-rw-r--r--llvm/include/llvm/Analysis/LoopAccessAnalysis.h11
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp8
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp11
3 files changed, 21 insertions, 9 deletions
diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index cea7523..26ddf92 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -541,8 +541,15 @@ public:
unsigned getNumStores() const { return NumStores; }
unsigned getNumLoads() const { return NumLoads;}
- /// Add code that checks at runtime if the accessed arrays \in p PointerChecks
- /// overlap.
+ /// Add code that checks at runtime if the accessed arrays overlap.
+ ///
+ /// Returns a pair of instructions where the first element is the first
+ /// instruction generated in possibly a sequence of instructions and the
+ /// second value is the final comparator value or NULL if no check is needed.
+ std::pair<Instruction *, Instruction *>
+ addRuntimeChecks(Instruction *Loc) const;
+
+ /// Generete the instructions for the checks in \p PointerChecks.
///
/// Returns a pair of instructions where the first element is the first
/// instruction generated in possibly a sequence of instructions and the
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 35780bd..77270ab 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2275,6 +2275,14 @@ std::pair<Instruction *, Instruction *> LoopAccessInfo::addRuntimeChecks(
return std::make_pair(FirstInst, Check);
}
+std::pair<Instruction *, Instruction *>
+LoopAccessInfo::addRuntimeChecks(Instruction *Loc) const {
+ if (!PtrRtChecking->Need)
+ return std::make_pair(nullptr, nullptr);
+
+ return addRuntimeChecks(Loc, PtrRtChecking->getChecks());
+}
+
void LoopAccessInfo::collectStridedAccess(Value *MemAccess) {
Value *Ptr = nullptr;
if (LoadInst *LI = dyn_cast<LoadInst>(MemAccess))
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 3209fb5e..b139f85 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2785,15 +2785,12 @@ void InnerLoopVectorizer::emitMemRuntimeChecks(Loop *L, BasicBlock *Bypass) {
// Generate the code that checks in runtime if arrays overlap. We put the
// checks into a separate block to make the more common case of few elements
// faster.
- auto *LAI = Legal->getLAI();
- const auto &RtPtrChecking = *LAI->getRuntimePointerChecking();
- if (!RtPtrChecking.Need)
- return;
Instruction *FirstCheckInst;
Instruction *MemRuntimeCheck;
- std::tie(FirstCheckInst, MemRuntimeCheck) = LAI->addRuntimeChecks(
- MemCheckBlock->getTerminator(), RtPtrChecking.getChecks());
- assert(MemRuntimeCheck && "Expected runtime checks to be generated");
+ std::tie(FirstCheckInst, MemRuntimeCheck) =
+ Legal->getLAI()->addRuntimeChecks(MemCheckBlock->getTerminator());
+ if (!MemRuntimeCheck)
+ return;
if (MemCheckBlock->getParent()->hasOptSize()) {
assert(Cost->Hints->getForce() == LoopVectorizeHints::FK_Enabled &&