[PATCH] peephole optimization in switch table lookup: reuse the guarding table comparison if possible

Hans Wennborg hans at chromium.org
Wed Nov 19 16:38:15 PST 2014


On Wed, Nov 19, 2014 at 1:21 AM, Erik Eckstein <eeckstein at apple.com> wrote:
> I did some investigation and found that we already have such an
> optimization.
> It is InstCombiner::FoldOpIntoPhi(Instruction &I) where I is the "r == 0"
> cmp instruction.

>From what I understand, this is doing something different: it's
basically transforming

x = phi(v1, v2, ...)
y = op(x)

into

y = phi(op(v1), op(v2), ...)

Which I don't think helps in your code example (at least not if r has
more uses than the "r==0" expression).

 - Hans



More information about the llvm-commits mailing list