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

Justin Kreiner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 13 11:54:32 PDT 2021


jkreiner marked 4 inline comments as done.
jkreiner added a comment.

I removed the unnecessary conditions, and used the llvm::DenseMap instead.



================
Comment at: llvm/lib/CodeGen/DFAJumpThreading.cpp:740
+    unsigned NumInsts = Metrics.NumInsts;
+    unsigned DuplicationCost = NumInsts / CondBranches;
+
----------------
Here is the cost calculation we implemented. It could be more accurate by accounting for instructions and blocks that get simplified, but for now it at least prevents code explosion. 


================
Comment at: llvm/lib/CodeGen/DFAJumpThreading.cpp:453
+    // Vector select instructions are not supported.
+    if (!SI->getCondition()->getType()->isIntegerTy(1)) {
+      return false;
----------------
efriedma wrote:
> Don't think you can end up with a vector select here; you've already constrained the result to be an integer.
Yes, I agree the vector select check was unnecessary here.


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

https://reviews.llvm.org/D99205



More information about the llvm-commits mailing list