[PATCH] D63389: [IDF] Generalize IDFCalculator to be used with Clang's CFG

Kristóf Umann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 15:16:13 PDT 2019


Szelethus created this revision.
Szelethus added reviewers: kuhar, asbirlea, george.burgess.iv, chandlerc, NoQ, xazax.hun.
Szelethus added a project: LLVM.
Herald added subscribers: llvm-commits, gamesh411, kristina, dkrupp, rnkovacs, hiraditya, mgorny.
Szelethus edited the summary of this revision.

I'm currently working on a GSoC project that aims to improve the the bug reports of the analyzer. The main heuristic I plan to use is to explain values that are a control dependency of the bug location better.

  01 bool b = messyComputation();
  02 int i = 0;
  03 if (val) // control dependency of the bug site, let's explain why we assume val to be true
  04   10 / i; // warn: division by zero

Because of this, I'd like to generalize `IDFCalculator` so that I could use it for Clang's CFG: D62883 <https://reviews.llvm.org/D62883>.

In detail:

- Rename `IDFCalculator` to `IDFCalculatorBase`, make it take a general CFG node type as a template argument rather then strictly `BasicBlock` (but preserve `ForwardIDFCalculator` and `ReverseIDFCalculator`)
- Move `IDFCalculatorBase` from `llvm/include/llvm/Analysis` to `llvm/include/llvm/Support` (but leave the `BasicBlock` variants in `llvm/include/llvm/Analysis`)
- clang-format the file since this patch messes up git blame anyways
- Change `typedef` to `using`
- Practically revert D50675 <https://reviews.llvm.org/D50675>. This was done because `GraphDiff` is only specialized for `BasicBlock`, and wouldn't be used for `clang::CFGBlcok`. Interestingly, it wasn't even used at all: In D45299 <https://reviews.llvm.org/D45299>, it was used at a certain point (https://reviews.llvm.org/D45299?id=160698) but was ultimately removed. Is this okay?
- Add the new method `IDFCalculatorBase::getChildren`. This is important because I'll have to specialize it for Clang's CFG to filter out nullpointer successors, similarly to D62507 <https://reviews.llvm.org/D62507>.


Repository:
  rL LLVM

https://reviews.llvm.org/D63389

Files:
  llvm/include/llvm/Analysis/IteratedDominanceFrontier.h
  llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h
  llvm/lib/Analysis/CMakeLists.txt
  llvm/lib/Analysis/IteratedDominanceFrontier.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63389.204967.patch
Type: text/x-patch
Size: 15571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190616/c3dd57a2/attachment.bin>


More information about the llvm-commits mailing list