[PATCH] D79679: [LAA] Remove one addRuntimeChecks function (NFC).
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 9 14:53:51 PDT 2020
fhahn created this revision.
fhahn added reviewers: Ayal, anemet.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
In order to reduce the API surface area (preparation for D78460 <https://reviews.llvm.org/D78460>), remove
a addRuntimeChecks() function and do the additional check in the single
caller.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79679
Files:
llvm/include/llvm/Analysis/LoopAccessAnalysis.h
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2785,12 +2785,15 @@
// 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) =
- Legal->getLAI()->addRuntimeChecks(MemCheckBlock->getTerminator());
- if (!MemRuntimeCheck)
- return;
+ std::tie(FirstCheckInst, MemRuntimeCheck) = LAI->addRuntimeChecks(
+ MemCheckBlock->getTerminator(), RtPtrChecking.getChecks());
+ assert(MemRuntimeCheck && "Expected runtime checks to be generated");
if (MemCheckBlock->getParent()->hasOptSize()) {
assert(Cost->Hints->getForce() == LoopVectorizeHints::FK_Enabled &&
Index: llvm/lib/Analysis/LoopAccessAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2275,14 +2275,6 @@
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))
Index: llvm/include/llvm/Analysis/LoopAccessAnalysis.h
===================================================================
--- llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -541,15 +541,8 @@
unsigned getNumStores() const { return NumStores; }
unsigned getNumLoads() const { return NumLoads;}
- /// 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.
+ /// Add code that checks at runtime if the accessed arrays \in p PointerChecks
+ /// overlap.
///
/// Returns a pair of instructions where the first element is the first
/// instruction generated in possibly a sequence of instructions and the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79679.263039.patch
Type: text/x-patch
Size: 2866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200509/371d5597/attachment.bin>
More information about the llvm-commits
mailing list