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

Justin Kreiner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 4 14:14:15 PDT 2021


jkreiner added a comment.

In D99205#2737106 <https://reviews.llvm.org/D99205#2737106>, @efriedma wrote:

> If we're going to be cloning basic blocks, we need some sort of cost computation. Some blocks aren't legal to clone, and some are expensive simply due to size.  (Illegal to clone like this: convergent, noduplicate, indirectbr predecessors.)  See llvm/Analysis/CodeMetrics.h.

That is a good point, I agree we will need a cost model for the transformation. I have started working on one and gathering more performance stats. Also thanks for sharing CodeMetrics.h, I can add a check for those types of blocks that aren't legal to clone.

> If I'm understanding correctly, the goal here is to specifically handle cases where we can completely eliminate the switch.  That's a bit narrow, but I guess it makes sense, as least as a first cut.

This is correct for how it has been implemented, but the transformation should also work for the general case where the switch can be partially threaded. The analysis part will need to be changed a bit to identify the partial threading opportunities, but it is possible in the future.


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

https://reviews.llvm.org/D99205



More information about the llvm-commits mailing list