diff options
| author | Michael Kruse <llvm@meinersbur.de> | 2017-07-20 16:47:57 +0000 |
|---|---|---|
| committer | Michael Kruse <llvm@meinersbur.de> | 2017-07-20 16:47:57 +0000 |
| commit | 3562f272cf05cf5df640069f55459b2cf52a16a0 (patch) | |
| tree | 556802f16729758a9d2bd93d1ec928196d9892d6 /polly/lib/Analysis | |
| parent | 4d4624c20cd970ec4f4e5ecd9d90e51443e32c0e (diff) | |
| download | bcm5719-llvm-3562f272cf05cf5df640069f55459b2cf52a16a0.tar.gz bcm5719-llvm-3562f272cf05cf5df640069f55459b2cf52a16a0.zip | |
[ScopInfo] Use map for lookupPHIReadOf. NFC.
Introduce previously missing PHIReads analogous the the already existing
PHIWrites/ValueWrites/ValueReads maps. PHIReads was initially not
required and the later introduced lookupPHIReadOf() used a linear
search instead.
With PHIReads, lookupPHIReadOf() can now also do a map lookup and remove
any surprising performance/behaviour differences to lookupPHIWriteOf(),
lookupValueWriteOf() and lookupValueReadOf().
llvm-svn: 308630
Diffstat (limited to 'polly/lib/Analysis')
| -rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index b89ed718855..80286cfcdb8 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -1309,19 +1309,6 @@ void ScopStmt::buildAccessRelations() { } } -MemoryAccess *ScopStmt::lookupPHIReadOf(PHINode *PHI) const { - for (auto *MA : *this) { - if (!MA->isRead()) - continue; - if (!MA->isOriginalAnyPHIKind()) - continue; - - if (MA->getAccessInstruction() == PHI) - return MA; - } - return nullptr; -} - void ScopStmt::addAccess(MemoryAccess *Access) { Instruction *AccessInst = Access->getAccessInstruction(); @@ -1344,6 +1331,11 @@ void ScopStmt::addAccess(MemoryAccess *Access) { assert(!PHIWrites.lookup(PHI)); PHIWrites[PHI] = Access; + } else if (Access->isAnyPHIKind() && Access->isRead()) { + PHINode *PHI = cast<PHINode>(Access->getAccessValue()); + assert(!PHIReads.lookup(PHI)); + + PHIReads[PHI] = Access; } MemAccs.push_back(Access); @@ -2017,6 +2009,11 @@ void ScopStmt::removeAccessData(MemoryAccess *MA) { (void)Found; assert(Found && "Expected access data not found"); } + if (MA->isRead() && MA->isOriginalAnyPHIKind()) { + bool Found = PHIReads.erase(cast<PHINode>(MA->getAccessInstruction())); + (void)Found; + assert(Found && "Expected access data not found"); + } } void ScopStmt::removeMemoryAccess(MemoryAccess *MA) { |

