[PATCH] D145688: [StructurizeCFG] Use UniformityAnalysis instead of DivergenceAnalysis

Sameer Sahasrabuddhe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 23:32:43 PST 2023


sameerds added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/StructurizeCFG.cpp:802
-  if (DA)
-    DA->removeValue(Term);
   Term->eraseFromParent();
----------------
Pierre-vh wrote:
> foad wrote:
> > Does UA need something like removeValue? I see it was added by @nhaehnle in D43743 "to avoid dangling pointers as a matter of defensive programming".
> I'm not too familiar with UA's implementation so I can't answer this, @sameerds does UA need anything like this?
Yeah, given the defensive nature of the comment, I thought we should put this in UA. But turns out that we don't really need to, because UA does not store pointers to terminator instructions. The side-effect of the structurizer is to delete and recreate terminators, but in the UA, a query on a terminator is actually done by looking up its parent basic block.

Also noteable is that only LegacyDA implemented this "remove" API. Although legacy DA acts as a wrapper to the newer DA, this particular function was never implemented in the latter.

In short, I think we don't need to implement this in UA.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145688/new/

https://reviews.llvm.org/D145688



More information about the llvm-commits mailing list