diff options
author | Duncan Sands <baldrick@free.fr> | 2008-09-29 13:35:31 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-09-29 13:35:31 +0000 |
commit | 224c86ee77c87cb90899041f4ee9027ac79d4fd2 (patch) | |
tree | 1b43633e42ee847e65b61f960ba69d1afc77fa6e /lib/Transforms | |
parent | 6aa812704fb05413b83955b52f87e105b567b4fe (diff) | |
download | external_llvm-224c86ee77c87cb90899041f4ee9027ac79d4fd2.zip external_llvm-224c86ee77c87cb90899041f4ee9027ac79d4fd2.tar.gz external_llvm-224c86ee77c87cb90899041f4ee9027ac79d4fd2.tar.bz2 |
Tweak some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56784 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/AddReadAttrs.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/AddReadAttrs.cpp b/lib/Transforms/IPO/AddReadAttrs.cpp index 3e7d860..b70bdaf 100644 --- a/lib/Transforms/IPO/AddReadAttrs.cpp +++ b/lib/Transforms/IPO/AddReadAttrs.cpp @@ -47,14 +47,14 @@ Pass *llvm::createAddReadAttrsPass() { return new AddReadAttrs(); } bool AddReadAttrs::runOnSCC(const std::vector<CallGraphNode *> &SCC) { CallGraph &CG = getAnalysis<CallGraph>(); - // Check if any of the functions in the SCC read or write memory. - // If they write memory then just give up. + // Check if any of the functions in the SCC read or write memory. If they + // write memory then they can't be marked readnone or readonly. bool ReadsMemory = false; for (unsigned i = 0, e = SCC.size(); i != e; ++i) { Function *F = SCC[i]->getFunction(); if (F == 0) - // External node - may write memory. + // External node - may write memory. Just give up. return false; if (F->doesNotAccessMemory()) @@ -65,7 +65,7 @@ bool AddReadAttrs::runOnSCC(const std::vector<CallGraphNode *> &SCC) { // something that writes memory, so treat them like declarations. if (F->isDeclaration() || F->mayBeOverridden()) { if (!F->onlyReadsMemory()) - // May write memory. + // May write memory. Just give up. return false; ReadsMemory = true; @@ -83,7 +83,9 @@ bool AddReadAttrs::runOnSCC(const std::vector<CallGraphNode *> &SCC) { continue; if (II->mayWriteToMemory()) + // Writes memory. Just give up. return false; + ReadsMemory |= II->mayReadFromMemory(); } } |