summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2017-05-11 22:56:27 +0000
committerMichael Kruse <llvm@meinersbur.de>2017-05-11 22:56:27 +0000
commitbfaa1857b3cb10556d4a2e157688adc918802984 (patch)
treec7c2ace2cdfb5675d77bfecc01811ade918944cc
parente60eca7316fffeed4f42dc1dcd5900679f0be647 (diff)
downloadbcm5719-llvm-bfaa1857b3cb10556d4a2e157688adc918802984.tar.gz
bcm5719-llvm-bfaa1857b3cb10556d4a2e157688adc918802984.zip
[VirtualInstruction] Do a lookup instead of a linear search. NFC.
llvm-svn: 302837
-rw-r--r--polly/lib/Support/VirtualInstruction.cpp21
1 files changed, 1 insertions, 20 deletions
diff --git a/polly/lib/Support/VirtualInstruction.cpp b/polly/lib/Support/VirtualInstruction.cpp
index 01c92d770f4..e3c2cfa3006 100644
--- a/polly/lib/Support/VirtualInstruction.cpp
+++ b/polly/lib/Support/VirtualInstruction.cpp
@@ -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, ScopStmt *UserStmt, Loop *UserScope,
// 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
OpenPOWER on IntegriCloud