[PATCH] D99205: Add jump-threading optimization for deterministic finite automata

Alexey Zhikhartsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 14:02:32 PDT 2021


alexey.zhikhar marked 11 inline comments as done.
alexey.zhikhar added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp:337
+    else
+      raw_string_ostream(BBName) << BB;
+    OS << BBName << " ";
----------------
SjoerdMeijer wrote:
> Do we need BBName?
> Can we not do something like:
> 
>   OS << BB->hasName() ? BB->getName() : "...";
> 
The idea here is to print the basic block itself if it has no name, e.g.:

```
1:
  %2 = ...
  %3 = ...
```

We can't say `OS << (BB->hasName() ? BB->getName() : *BB);` since both legs of a ternary operator must be of the same type.


================
Comment at: llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp:485
+    // The use of the select inst should be either a phi or another select.
+    if (!SIUse && !(isa<PHINode>(SIUse) || isa<SelectInst>(SIUse))) {
+      return false;
----------------
SjoerdMeijer wrote:
> Same,
> 
> and actually in a lot more cases, so will stop mentioning it from now on, but there's opportunities to get rid of a lot of curly brackets. :-)
Thanks, I went through the whole file looking for unnecessary curly braces, so now they should be no more. Please feel free to let me know if I missed something.


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

https://reviews.llvm.org/D99205



More information about the llvm-commits mailing list