[polly] r302837 - [VirtualInstruction] Do a lookup instead of a linear search. NFC.
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Thu May 11 15:56:27 PDT 2017
Author: meinersbur
Date: Thu May 11 17:56:27 2017
New Revision: 302837
URL: http://llvm.org/viewvc/llvm-project?rev=302837&view=rev
Log:
[VirtualInstruction] Do a lookup instead of a linear search. NFC.
Modified:
polly/trunk/lib/Support/VirtualInstruction.cpp
Modified: polly/trunk/lib/Support/VirtualInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/VirtualInstruction.cpp?rev=302837&r1=302836&r2=302837&view=diff
==============================================================================
--- polly/trunk/lib/Support/VirtualInstruction.cpp (original)
+++ polly/trunk/lib/Support/VirtualInstruction.cpp Thu May 11 17:56:27 2017
@@ -18,25 +18,6 @@
using namespace polly;
using namespace llvm;
-namespace {
-
-/// If InputVal is not defined in the stmt itself, return the MemoryAccess that
-/// reads the scalar. Return nullptr otherwise (if the value is defined in the
-/// scop, or is synthesizable)
-MemoryAccess *getInputAccessOf(Value *InputVal, ScopStmt *UserStmt) {
- for (auto *MA : *UserStmt) {
- if (!MA->isRead())
- continue;
- if (!MA->isOriginalValueKind())
- continue;
-
- if (MA->getAccessValue() == InputVal)
- return MA;
- }
- return nullptr;
-}
-} // namespace
-
VirtualUse VirtualUse ::create(Scop *S, Use &U, LoopInfo *LI, bool Virtual) {
auto *UserBB = getUseBlock(U);
auto *UserStmt = S->getStmtFor(UserBB);
@@ -74,7 +55,7 @@ VirtualUse VirtualUse::create(Scop *S, S
// use. This is why we look for a MemoryAccess here already.
MemoryAccess *InputMA = nullptr;
if (UserStmt && Virtual)
- InputMA = getInputAccessOf(Val, UserStmt);
+ InputMA = UserStmt->lookupValueReadOf(Val);
// Uses are read-only if they have been defined before the SCoP, i.e., they
// cannot be written to inside the SCoP. Arguments are defined before any
More information about the llvm-commits
mailing list