mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-20 09:30:43 +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:
parent
38a2cb9379
commit
3b3b4e3f0f
@ -307,20 +307,6 @@ bool FunctionAttrs::AddNoCaptureAttrs(const std::vector<CallGraphNode *> &SCC) {
|
||||
// External node - skip it;
|
||||
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
|
||||
// something that writes memory, so treat them like declarations.
|
||||
if (F->isDeclaration() || F->mayBeOverridden())
|
||||
|
Loading…
Reference in New Issue
Block a user