[PATCH] D13064: Add CFG Simplification pass after Loop Unswitching.

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 17:36:12 PDT 2015


mzolotukhin added a comment.

Hi Hal,

> What's the overall change to the pass/analysis schedule? I'd tend to think that putting it after InstCombine would be better so it would not need to recompute DT again for InstCombine.


That shouldn't matter because `InstCombine` preserves DominatorTree - so we'll rebuild it after `SimplifyCFG` only once. If we run `SimplifyCFG` after `InstCombine`, we invoke `Basic Alias Analysis (stateless AA impl)` twice (, but as far as I understand it's almost free.

Michael

PS: The structures of passes are the following:
 (Disclaimer: it's only readable in phabricator)

| **__Original structure__**               | **__SimplifyCFG before InstCombine__**   | **__SimplifyCFG after InstCombine__**        |
| ...                                      | ...                                      | ...                                          |
| Unswitch loops                           | Unswitch loops                           | Unswitch loops                               |
|                                          | **Simplify the CFG**                     |                                              |
| Basic Alias Analysis (stateless AA impl) | Basic Alias Analysis (stateless AA impl) | Basic Alias Analysis (stateless AA impl)     |
| Function Alias Analysis Results          | Function Alias Analysis Results          | Function Alias Analysis Results              |
|                                          | **Dominator Tree Construction**          |                                              |
| Combine redundant instructions           | Combine redundant instructions           | Combine redundant instructions               |
|                                          |                                          | **Simplify the CFG**                         |
|                                          |                                          | **Dominator Tree Construction**              |
|                                          | Natural Loop Information                 | Natural Loop Information                     |
| Scalar Evolution Analysis                | Scalar Evolution Analysis                | Scalar Evolution Analysis                    |
| Canonicalize natural loops               | Canonicalize natural loops               | Canonicalize natural loops                   |
| Loop-Closed SSA Form Pass                | Loop-Closed SSA Form Pass                | Loop-Closed SSA Form Pass                    |
| Induction Variable Simplification        | Induction Variable Simplification        | Induction Variable Simplification            |
|                                          |                                          | **Basic Alias Analysis (stateless AA impl)** |
| Function Alias Analysis Results          | Function Alias Analysis Results          | Function Alias Analysis Results              |
| Recognize loop idioms                    | Recognize loop idioms                    | Recognize loop idioms                        |
| ...                                      | ...                                      | ...                                          |


http://reviews.llvm.org/D13064





More information about the llvm-commits mailing list