summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-09-29 13:35:31 +0000
committerDuncan Sands <baldrick@free.fr>2008-09-29 13:35:31 +0000
commite340e18783d8df5552aad6bc54b38be25e4d926b (patch)
tree0216bd487d1afd843302db80007c0e2f11ddc830 /llvm/lib/Transforms
parenteed995b7967658006b5efb779707071269b6ed57 (diff)
downloadbcm5719-llvm-e340e18783d8df5552aad6bc54b38be25e4d926b.tar.gz
bcm5719-llvm-e340e18783d8df5552aad6bc54b38be25e4d926b.zip
Tweak some comments.
llvm-svn: 56784
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/AddReadAttrs.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/AddReadAttrs.cpp b/llvm/lib/Transforms/IPO/AddReadAttrs.cpp
index 3e7d860d1d8..b70bdaf763a 100644
--- a/llvm/lib/Transforms/IPO/AddReadAttrs.cpp
+++ b/llvm/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();
}
}
OpenPOWER on IntegriCloud