[PATCH] D75977: [JumpThreading] Fix PR44611

JunMa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 18:15:09 PDT 2020


junparser marked an inline comment as done.
junparser added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:455
+      // We may hit cycles, just add it to Unreachable.
+      if (!DTU->getDomTree().isReachableFromEntry(&BB)) {
+        Unreachable.insert(&BB);
----------------
efriedma wrote:
> We've been trying to avoid calling getDomTree() in JumpThreading where possible because there's a performance cost: it actually flushes all the pending DomTree updates.  Calling it for every basic block will likely cause performance issues.  (You should be able to find some discussion of this in the review threads for the related JumpThreading patches.)
Yes, I have already know about that.  That's why i add this check at the end of for statement after other checks. However, for unreachable cycles,  I afraid maybe this is the only way to check (maybe I am wrong).

Btw, the condition can be update to:

```
 if (Changed && !DTU->getDomTree().isReachableFromEntry(&BB)) 
```
which can reduce the performance cost.


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

https://reviews.llvm.org/D75977





More information about the llvm-commits mailing list