[llvm] r303387 - [InstCombine] add more tests for xor-of-icmps; NFC

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 11:28:20 PDT 2017


On Fri, May 19, 2017 at 11:00 AM, Davide Italiano <davide at freebsd.org>
wrote:

> On Fri, May 19, 2017 at 10:00 AM, Sanjay Patel <spatel at rotateright.com>
> wrote:
> > Is "VRP" (value range propagation) in LLVM-speak "CVP" (correlated value
> > propagation)?
> >
> > If so, we have this comment regarding compares:
> >   // As a policy choice, we choose not to waste compile time on anything
> > where
> >   // the comparison is testing local values.
> >
> > Or this for div/rem:
> >   // As a policy choice, we choose not
> >   // to waste compile time on anything where the operands are local defs.
> >
> > "Local" means in the same basic block from what I can tell by the code
> here.
> >
> > I think this means that this pass explicitly defers handling simple cases
> > like:
> > https://reviews.llvm.org/D33342
> > ...to another pass, and currently that pass is InstCombine (because the
> > patterns really can't be any simpler than the tests in that patch,
> right?).
> >
> > I think that improving compile-time should not preclude improving
> > InstCombine. We should do both.
> >
>
> Just thoughts, feel free to ignore them.
> I didn't measure the impact in LLVM, but I'm sure you can do VRP
> relatively fast (GCC does that both interprocedurally and
> intraprocedurally and their pass is much faster in some cases than
> LLVM's), i.e. O(N) in practice, so, maybe we could re-evaluate this
> policy?
>

Yeah, that's kind of silly, we can do much better.


> I think replacing a pass in LLVM is not trivial (I'm learning it the
> hard way with NewGVN). OTOH, I'm still not entirely convinced
> `InstCombine` should handle these cases given it's already a
> compile-time sink?
>


People seem intent on adding lots and lots of stuff to instcombine because
it's easy.
This makes it harder to ever replace, while simultaneously making it slower.
It's not hard to see where that path ends up.
InstCombine does a lot of random crap that isn't even combining or graph
rewrite, too, because well second and third order effects are hard.

If we want an optimal graph rewriter, we should actually just build one,
with sane rewrite rules, verification that it fixpoints, and some sense of
good ordering, etc,  instead of  slowly every adding possible pattern match
to InstCombine.

(and then split out the crap that isn't rewriting, and if we need to
understand how to get second and third order effects, let's sit down and
think about it instead of the brute force approach we do now).

But that's just kibitzing.

--Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170519/f2bd0939/attachment.html>


More information about the llvm-commits mailing list