mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +00:00
Eliminate trivial redundant loads across nocapture+readonly calls to uncaptured
pointer arguments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185776 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -450,6 +450,7 @@ AliasAnalysis::callCapturesBefore(const Instruction *I,
|
||||
return AliasAnalysis::ModRef;
|
||||
|
||||
unsigned ArgNo = 0;
|
||||
AliasAnalysis::ModRefResult R = AliasAnalysis::NoModRef;
|
||||
for (ImmutableCallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end();
|
||||
CI != CE; ++CI, ++ArgNo) {
|
||||
// Only look at the no-capture or byval pointer arguments. If this
|
||||
@@ -463,12 +464,18 @@ AliasAnalysis::callCapturesBefore(const Instruction *I,
|
||||
// is impossible to alias the pointer we're checking. If not, we have to
|
||||
// assume that the call could touch the pointer, even though it doesn't
|
||||
// escape.
|
||||
if (!isNoAlias(AliasAnalysis::Location(*CI),
|
||||
AliasAnalysis::Location(Object))) {
|
||||
return AliasAnalysis::ModRef;
|
||||
if (isNoAlias(AliasAnalysis::Location(*CI),
|
||||
AliasAnalysis::Location(Object)))
|
||||
continue;
|
||||
if (CS.doesNotAccessMemory(ArgNo))
|
||||
continue;
|
||||
if (CS.onlyReadsMemory(ArgNo)) {
|
||||
R = AliasAnalysis::Ref;
|
||||
continue;
|
||||
}
|
||||
return AliasAnalysis::ModRef;
|
||||
}
|
||||
return AliasAnalysis::NoModRef;
|
||||
return R;
|
||||
}
|
||||
|
||||
// AliasAnalysis destructor: DO NOT move this to the header file for
|
||||
|
||||
Reference in New Issue
Block a user