mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-07 04:38:20 +00:00
Teach FunctionAttrs about AccessesArgumentsReadonly.
llvm-svn: 118617
This commit is contained in:
parent
0f262ff853
commit
4cba066d9f
@ -152,6 +152,25 @@ bool FunctionAttrs::AddReadAttrs(const CallGraphSCC &SCC) {
|
||||
}
|
||||
// Only reads and writes local memory.
|
||||
continue;
|
||||
case AliasAnalysis::AccessesArgumentsReadonly:
|
||||
// Check whether all pointer arguments point to local memory, and
|
||||
// ignore calls that only access local memory.
|
||||
for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end();
|
||||
CI != CE; ++CI) {
|
||||
Value *Arg = *CI;
|
||||
if (Arg->getType()->isPointerTy()) {
|
||||
AliasAnalysis::Location Loc(Arg,
|
||||
AliasAnalysis::UnknownSize,
|
||||
I->getMetadata(LLVMContext::MD_tbaa));
|
||||
if (!AA->pointsToConstantMemory(Loc, /*OrLocal=*/true)) {
|
||||
// Reads non-local memory.
|
||||
ReadsMemory = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Only reads memory.
|
||||
continue;
|
||||
default:
|
||||
// Otherwise, be conservative.
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user