[llvm-commits] patch: improve instsimplify with non-recursive ranges

Frits van Bommel fvbommel at gmail.com
Thu Mar 3 13:33:02 PST 2011


On Thu, Mar 3, 2011 at 9:04 PM, Nick Lewycky <nlewycky at google.com> wrote:
> Hi, I wrote a patch to InstSimplify to fix a TODO that I added while doing
> other improvements in the same area. The attached patch matches "icmp pred
> (binop x, CI2), CI" and uses some simple ConstantRange math to find the
> cases this is always true or false.

All those match(LHS, ...) clauses are mutually-exclusive, so they
should probably be chained with 'else if'.

> It seems a little weird to me that we weren't already catching some of these
> cases, and also that there isn't a utility method somewhere that produces a
> ConstantRange given an instruction for me. Should I land this patch as-is,
> then try to find pieces of instcombine (and others?) that are now redundant?

It'd already be make the code right above it redundant if you'd use a
"full set" constant range when the LHS doesn't match any of the
clauses...



More information about the llvm-commits mailing list