[PATCH] D68898: JumpThreading: enhance JT to handle BB with no successor and address comparison

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 10:17:08 PDT 2019


On Mon, Oct 14, 2019 at 1:15 PM Eli Friedman via Phabricator <
reviews at reviews.llvm.org> wrote:

> efriedma added a comment.
>
> > Handling what Wei's case will be a nice thing to have, but it may
> require more significant change in JT.
>
> I think we need to have a plan for what this is going to look like, so the
> new code here doesn't immediately become obsolete.
>
>
Longer term, I think we should have a different IR optimization pass to do
simplification (non controlflow) based tailDuplication pass. Most of the
code in JT pass can be reused, so a lot of refactorization is needed to
make majority of the code into a utility.



> > Another thing to consider is the cost model difference.
>
> I think the necessary cost model is effectively the same for ret vs. other
> instructions.  In particular, the "ret" might go away after after inlining.
>
>
Right. This is actually another reason handling 'ret' belongs to JT because
after inlining it will most likely become a normal jump-threading
candidate. However we should not fully rely on inlining transformation to
enable this optimization.


>
> ================
> Comment at: lib/Transforms/Scalar/JumpThreading.cpp:2005
>      LVI->enableDT();
>    LVI->threadEdge(PredBB, BB, SuccBB);
>
> ----------------
> I'm surprised threadEdge still works.  Probably want to update the
> documentation for that API if we really want to allow SuccBB to be null.
>
>
I looked at the code  -- it seems to handle this by design. It is a
worklist based method that drops cached value entries in old SuccBB and all
its descendents (except from NewSuccBB).  If the oldSuccBB does not have
any successors, it will just drop values in it and terminates.







>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D68898/new/
>
> https://reviews.llvm.org/D68898
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191015/f1962e94/attachment.html>


More information about the llvm-commits mailing list