We often failed in the assertion, non-deterministically with a large IR:
```
Assertion `notDifferentParent(LocA.Ptr, LocB.Ptr) && "BasicAliasAnalysis doesn't support interprocedural queries."
```
Looking at the comment in https://reviews.llvm.org/D87806, it appears it's actually a module pass for new PM while the legacy PM still works as a function pass.
The fix is to align the same behavior in between new PM and old PM, which initializes ObjCARCContract for each function.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/
D121949
};
class ObjCARCContractLegacyPass : public FunctionPass {
- ObjCARCContract OCARCC;
-
public:
void getAnalysisUsage(AnalysisUsage &AU) const override;
- bool doInitialization(Module &M) override;
bool runOnFunction(Function &F) override;
static char ID;
return new ObjCARCContractLegacyPass();
}
-bool ObjCARCContractLegacyPass::doInitialization(Module &M) {
- return OCARCC.init(M);
-}
-
bool ObjCARCContractLegacyPass::runOnFunction(Function &F) {
+ ObjCARCContract OCARCC;
+ OCARCC.init(*F.getParent());
auto *AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
return OCARCC.run(F, AA, DT);