[PATCH] D34135: [LVI] Add initial result to avoid infinite getValueFromCondition recursion

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 00:58:04 PDT 2017


dberlin added a comment.



In https://reviews.llvm.org/D34135#779994, @uabelho wrote:

> In https://reviews.llvm.org/D34135#779992, @dberlin wrote:
>
> > Is there a reason the caller can't avoid making calls on unreachable blocks?
>
>
> I can only refer to what Eli said in the PR:
>  https://bugs.llvm.org//show_bug.cgi?id=33357#c7
>
> "The alternative is that specifically disallow calling into LazyValueInfo on dead code... but it would be much harder to handle in JumpThreading given the way the pass works."
>
> (Myself I don't know JumpThreading and I don't know LazyValueInfo.)


I would like to understand more about this from Eli.

The problem is that:
We currently allow unbounded craziness in unreachable blocks (which i still believe does not make sense compared to something like 'blocks without parents can have whatever they want, but when attached to a function, gotta be verifiable', but such is life).  This means any sane analysis generally has to avoid going into them anyway, because really, any optimistic or fixpointing or ... analysis will break pretty easily in a myriad of ways.

It happens that LVI is not optimal, fixpointing, etc.

But at the same time, if you  let jumpthreading ask LVI about unbounded craziness, you are now condemning everything LVI ever uses (simplifiers, other analysis) to try to handle it as well.  Which is not really going to happen, it's just going to cause more bugs over time :P
So it's, IMHO, not a good choice if it can be avoided.

If the issue in JumpThreading is determining reachability at all times, that we can solve in the next few weeks with the dynamic dominators stuff (it will always, at all times, have correct reachability from entry block, as long as you tell it what edges you changed)
If it's something else, i'd love to know what  so i can see if i can help.
Because at worst, i would have expected you to be able to build an LVI wrapper (well, LVI is already a wrapper anyway) for jumpthreading that checks reachability, says "no idea" if it's unreachable, and others, calls the regular LVI impl.
(LVI itself should already try to avoid walking edges back into forward unreachable blocks)
I would also expect, in practice, you could do something better.


https://reviews.llvm.org/D34135





More information about the llvm-commits mailing list