mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
Any void readonly functions are provably dead, don't waste time adding
nocapture attributes to them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61610 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -307,20 +307,6 @@ bool FunctionAttrs::AddNoCaptureAttrs(const std::vector<CallGraphNode *> &SCC) {
|
|||||||
// External node - skip it;
|
// External node - skip it;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the function is readonly and doesn't return any value, we know that
|
|
||||||
// the pointer value is not captured. Mark all of its pointer arguments
|
|
||||||
// nocapture.
|
|
||||||
if (F->onlyReadsMemory() && F->getReturnType() == Type::VoidTy) {
|
|
||||||
for (Function::arg_iterator A = F->arg_begin(), E = F->arg_end();
|
|
||||||
A != E; ++A)
|
|
||||||
if (isa<PointerType>(A->getType()) && !A->hasNoCaptureAttr()) {
|
|
||||||
A->addAttr(Attribute::NoCapture);
|
|
||||||
++NumNoCapture;
|
|
||||||
Changed = true;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Definitions with weak linkage may be overridden at linktime with
|
// Definitions with weak linkage may be overridden at linktime with
|
||||||
// something that writes memory, so treat them like declarations.
|
// something that writes memory, so treat them like declarations.
|
||||||
if (F->isDeclaration() || F->mayBeOverridden())
|
if (F->isDeclaration() || F->mayBeOverridden())
|
||||||
|
Reference in New Issue
Block a user