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

Nick Lewycky nicholas at mxc.ca
Thu Mar 3 23:05:14 PST 2011


Frits van Bommel wrote:
> 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'.

Good catch. Fixed!

>> 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...

Done, with a different technique (hoist the RHS_CR calculation up and 
look for full/empty of that).

Thanks and committed!

Nick



More information about the llvm-commits mailing list