[PATCH] D53203: Allow MemoryLocation to carry pre-existing knowledge to AA to elide expensive repeated checks
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 31 12:04:18 PDT 2018
asbirlea added inline comments.
================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:819
if (!isa<Constant>(Object) && CS.getInstruction() != Object &&
- isNonEscapingLocalObject(Object)) {
+ ((Loc.isKnownToBeLocalObject() && Loc.isKnownToBeNonEscaping()) ||
+ (!Loc.isKnownCouldBeNonLocalObject() && !Loc.isKnownMayEscape() &&
----------------
Add an assert before this to check:
```
assert((!Loc.isKnownToBeLocalObject() || !Loc.isKnownCouldBeNonLocalObject()) &&
"Location cannot be both known local and known non-local");
assert((!Loc.isKnownToBeNonEscaping() || !Loc.isKnownMayEscape() &&
"Location cannot be both known non escaping and known it may escape");
```
================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:822
+ isNonEscapingLocalObject(Object)))) {
// Optimistically assume that call doesn't touch Object and check this
----------------
Update flags in Loc here if isNonEscapingLocalObject was called?
This will make Loc non-const, which is a larger chance in itself and there should be some comments added if we make getModRefInfo have side-effects.
================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:774
+ // lots of allocas and lots of noreturn functions (e.g. assert)
+ KnownFlags |= PointerMayBeCaptured(&I, false, true)
+ ? MLK_KnownMayEscape
----------------
Can we avoid this call and leave the Escaping bits both not set?
Precisely because PointerMayBeCaptured is expensive. Ideally this should be computed only on demand (in geModRefInfo) and the info passed back when caching.
================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:876
+
+ return isRefSet(AA->getModRefInfo(CS, Loc));
});
----------------
Check if Loc was updated by the ModRef call and update the cache?
Repository:
rL LLVM
https://reviews.llvm.org/D53203
More information about the llvm-commits
mailing list