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

<br></div><div>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? Should this code be factored out? Should I copy some of this logic into LazyValueInfo?</div>

<div><br></div><div>Nick</div><div><br></div>