[PATCH] D121949: [ObjCARC] Fix non-determinism

Kyungwoo Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 13:55:19 PDT 2022


kyulee created this revision.
Herald added subscribers: mgrang, hiraditya.
Herald added a project: All.
kyulee requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121949

Files:
  llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp


Index: llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
===================================================================
--- llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
+++ llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
@@ -102,11 +102,8 @@
 };
 
 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;
@@ -740,11 +737,9 @@
   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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121949.416309.patch
Type: text/x-patch
Size: 974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220317/fefb1a3b/attachment.bin>


More information about the llvm-commits mailing list