Skip to content

Commit ddb85f3

Browse files
author
Kyungwoo Lee
committed
[ObjCARC] Fix non-determinism
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
1 parent 3e02c8e commit ddb85f3

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,8 @@ class ObjCARCContract {
102102
};
103103

104104
class ObjCARCContractLegacyPass : public FunctionPass {
105-
ObjCARCContract OCARCC;
106-
107105
public:
108106
void getAnalysisUsage(AnalysisUsage &AU) const override;
109-
bool doInitialization(Module &M) override;
110107
bool runOnFunction(Function &F) override;
111108

112109
static char ID;
@@ -737,11 +734,9 @@ Pass *llvm::createObjCARCContractPass() {
737734
return new ObjCARCContractLegacyPass();
738735
}
739736

740-
bool ObjCARCContractLegacyPass::doInitialization(Module &M) {
741-
return OCARCC.init(M);
742-
}
743-
744737
bool ObjCARCContractLegacyPass::runOnFunction(Function &F) {
738+
ObjCARCContract OCARCC;
739+
OCARCC.init(*F.getParent());
745740
auto *AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
746741
auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
747742
return OCARCC.run(F, AA, DT);

0 commit comments

Comments
 (0)