[PATCH] D43173: [CallSiteSplitting] Preserve DominatorTreeAnalysis.

Brian Rzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 09:39:09 PST 2018


brzycki added inline comments.


================
Comment at: lib/Transforms/Scalar/CallSiteSplitting.cpp:410
   auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
+  auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
 
----------------
fhahn wrote:
> junbuml wrote:
> > fhahn wrote:
> > > junbuml wrote:
> > > > Considering that this pass doesn't use DT, do we need to get DT to preserve DT ?
> > > We need the current dominator tree, so we can update it. Not sure if there is a better way to get it though.
> > I just wanted to ask if constructing DT in advance is just okay because this pass doesn't even use DT. Isn't it okay to construct DT when DT  is really required in a later pass?
> I'll check. AFAIK CallSiteSplitting is run after a bunch of passes that require the DT to be constructed already and by saying we do not preserve the DT we force it to be re-computed.
Hi @fhahn , you should just need one additional line in your patch to inform the pass manager to properly preserve DT.
```
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
```

You can use `-debug-pass=Executions` with `opt` during testing to verify the order of creation/deletion of the Dominator Tree pass.  Here's an example snippet:

```
[2018-02-12 11:37:22.659888285] 0x1fb5240     Executing Pass 'Dominator Tree Construction' on Function 'test1'...
[2018-02-12 11:37:22.659992339] 0x1fb5240     Executing Pass 'Basic Alias Analysis (stateless AA impl)' on Function 'test1'...
[2018-02-12 11:37:22.660156849] 0x1fb5240     Executing Pass 'Function Alias Analysis Results' on Function 'test1'...
[2018-02-12 11:37:22.660254827] 0x1fb5240     Executing Pass 'Lazy Value Information Analysis' on Function 'test1'...
[2018-02-12 11:37:22.660302165] 0x1fb5240     Executing Pass 'Jump Threading' on Function 'test1'...
[2018-02-12 11:37:22.661679568] 0x1fb5240     Made Modification 'Jump Threading' on Function 'test1'...
[2018-02-12 11:37:22.661739504] 0x1fb5240      Freeing Pass 'Basic Alias Analysis (stateless AA impl)' on Function 'test1'...
[2018-02-12 11:37:22.661767275] 0x1fb5240      Freeing Pass 'Function Alias Analysis Results' on Function 'test1'...
[2018-02-12 11:37:22.661795430] 0x1fb5240      Freeing Pass 'Lazy Value Information Analysis' on Function 'test1'...
[2018-02-12 11:37:22.661840127] 0x1fb5240      Freeing Pass 'Jump Threading' on Function 'test1'...
[2018-02-12 11:37:22.661870858] 0x1fb5240      Freeing Pass 'Dominator Tree Construction' on Function 'test1'...
[2018-02-12 11:37:22.661904074] 0x1fb5240     Executing Pass 'Module Verifier' on Function 'test1'...
```


Repository:
  rL LLVM

https://reviews.llvm.org/D43173





More information about the llvm-commits mailing list