[PATCH] D109762: [NewPM][SimpleLoopUnswitch] Add DivergenceInfo

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 09:18:35 PDT 2021


aeubanks added a comment.

In D109762#3069261 <https://reviews.llvm.org/D109762#3069261>, @sameerds wrote:

> In D109762#3059988 <https://reviews.llvm.org/D109762#3059988>, @aeubanks wrote:
>
>> I talked to some people and we've decided that the best thing to do would be to refactor out the nontrivial unswitching part into a function pass. Nontrivial unswitching is fairly special in the kinds of transforms it does.
>
> Will that always work as expected? The real dependency is that the divergence analysis is not incrementally updated. So even if this is a function pass, we may want to rerun it on the whole function every time it manages to unswitch a loop.

With this patch, we have to rerun DivergenceAnalysis every time we run the pass on every loop. If we change nontrivial unswitching into a function pass, we can upgrade that to only having to be rerun every time we actually unswitch something.
To be more specific, with the function pass, we'd have to invalidate most analyses anyway after every successful unswitch.

  for every loop
    DA = FAM.getAnalysis<DivergenceAnalysis>(); // this will not rerun the analysis if we haven't invalidated below because we didn't successfully unswitch
    if successful unswitch
      auto PA = PreservedAnalyases::none();
      PA.preserve<SCEV>();
      // and all the other existing analyses we preserved
      FAM.invalidate(PA);


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

https://reviews.llvm.org/D109762



More information about the llvm-commits mailing list