[jit] Implement one-argument AliasDb::mayContainAlias more efficiently (#65177)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65177

There is no need to heap-allocate any vectors in this case.
ghstack-source-id: 140052520

Test Plan:
CI

Startup for static runtime on ctr_mobile_feed local net decreased from 7.8s to about 7.0s

Reviewed By: malfet

Differential Revision: D30984194

fbshipit-source-id: 85091e55445f653ec728b27da4b459a2f1873013
This commit is contained in:
Scott Wolchok 2021-10-08 10:24:36 -07:00 committed by Facebook GitHub Bot
parent c80693f7e6
commit 94845fc44e

View File

@ -1214,10 +1214,10 @@ bool AliasDb::mayAlias(const ValueSet& a, const ValueSet& b) const {
}
bool AliasDb::mayContainAlias(Value* a, Value* b) const {
const std::vector<Value*> a_vec = {a};
const std::vector<Value*> b_vec = {b};
return mayContainAlias(a_vec, b_vec);
if (!isMutableTypeInternal(a) || !isMutableTypeInternal(b)) {
return false;
}
return memoryDAG_->mayContainAlias(elementMap_.at(a), elementMap_.at(b));
}
std::vector<Element*> AliasDb::getElements(at::ArrayRef<Value*> vs) const {