[llvm-commits] [llvm] r56784 - /llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp
Duncan Sands
baldrick at free.fr
Mon Sep 29 06:35:32 PDT 2008
Author: baldrick
Date: Mon Sep 29 08:35:31 2008
New Revision: 56784
URL: http://llvm.org/viewvc/llvm-project?rev=56784&view=rev
Log:
Tweak some comments.
Modified:
llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp
Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp?rev=56784&r1=56783&r2=56784&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Mon Sep 29 08:35:31 2008
@@ -47,14 +47,14 @@
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 @@
// 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 @@
continue;
if (II->mayWriteToMemory())
+ // Writes memory. Just give up.
return false;
+
ReadsMemory |= II->mayReadFromMemory();
}
}
More information about the llvm-commits
mailing list