[XLA:LLVM] Allow LLVM AA to work cross-functions.

Create our AA domain with createAliasScopeDomain rather than
createAnonymousAliasScopeDomain.  This way inlining does not duplicate
the domain (and thus prevent us from reasoning about loads/stores that
cross the inlined function boundary).

PiperOrigin-RevId: 171299706
This commit is contained in:
Justin Lebar 2017-10-06 09:12:22 -07:00 committed by TensorFlower Gardener
parent 2226790bbf
commit fb0df6d9de

View File

@ -92,7 +92,16 @@ void AliasAnalysis::AddAliasingInformationToIrArray(const HloInstruction& hlo,
llvm::MDNode* AliasAnalysis::GetAliasDomain() {
llvm::MDBuilder metadata_builder(*context_);
if (alias_domain_ == nullptr) {
alias_domain_ = metadata_builder.createAnonymousAliasScopeDomain();
// We use createAliasScopeDomain rather than createAnonymousAliasScopeDomain
// so that when functions get inlined, we continue using the one domain,
// rather than duplicating it (and thus having two AA domains in one
// function).
//
// A side-effect of this is that if you ever compile two HLO modules in the
// same LLVM module, they'll have the same alias scope domain. This isn't a
// problem because the two HLO modules will never interact with one another.
alias_domain_ =
metadata_builder.createAliasScopeDomain("XLA global AA domain");
}
return alias_domain_;
}