[PATCH] D62619: [analyzer][Dominators] Add a control dependency tree builder + a new debug checker

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 19:08:40 PDT 2019


Szelethus added a comment.

I seem to have made good progress on this, although it did require a lot of code changes on LLVM side (basically turning `BasicBlock *` to template arguments). Here's a sample:

  //                               <----------------------------------
  //                              /              <-----------------   \
  //                             /              /                  \   \
  // [B12 (ENTRY)] -> [B11] -> [B10]-> [B9] -> [B8] ---> [B7] -> [B6]  |
  //                             |      \        \                     /
  //                             |       \        -----> [B2] --------/
  //                             |        \      /
  //                             |          -> [B5] -> [B4] -> [B3]
  //                             |               \              /
  //                             |                <------------
  //                              \
  //                               -> [B1] -> [B0 (EXIT)]
  
  Control dependencies  (Node, Dependency):
  (2,10)
  (3,5)
  (3,9)
  (3,10)
  (4,5)
  (4,9)
  (4,10)
  (5,9)
  (5,5)
  (5,10)
  (6,8)
  (6,9)
  (6,10)
  (7,8)
  (7,9)
  (7,10)
  (8,9)
  (8,8)
  (8,10)
  (9,10)
  (10,10)

My solution is inspired by

In D62619#1521824 <https://reviews.llvm.org/D62619#1521824>, @kuhar wrote:

> - https://github.com/seahorn/seahorn/blob/deep-dev-5.0/include/seahorn/Analysis/ControlDependenceAnalysis.hh
> - https://github.com/seahorn/seahorn/blob/deep-dev-5.0/lib/Analysis/ControlDependenceAnalysis.cc


, and I really like where this is going. I am yet to figure out how to deal with Clang's CFG containing null pointers in a not-too-invasive way (will probably end up doing something similar to `ChildrenGetter`), as it currently crashes.


Repository:
  rC Clang

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

https://reviews.llvm.org/D62619





More information about the cfe-commits mailing list