[PATCH] D44367: [InstCombine] peek through FP casts for sign-bit compares (PR36682)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 11 11:26:46 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D44367#1034208, @spatel wrote:

> In https://reviews.llvm.org/D44367#1034194, @lebedev.ri wrote:
>
> > In the mean time i experimented with generating the testcases (clearly, overdone it), and this patch does not handle all the cases i've come up with. Or maybe the cases are just invalid, which is more likely.
>
>
> Nice. I thought about the X == 0 and X != 0 cases just after I posted this. I think those are safe to add in a small follow-up patch.
>
> We should canonicalize other signbit-check predicates (sle / sge) to this form. Are you seeing any of those cases fail to match with this patch?


Eh, hard to say, there are more not changed patterns than changed, as you can see from the attached `cast-int-icmp-eq-0.ll`.
In particular, if the sizes change (when input size != bitcast fp type), then it's not handled.
All `uitofp` are not handled, obviously. And non `slt 0`/`sgt -1` condition codes are not touched, too.

Should some version of that  `cast-int-icmp-eq-0.ll` be committed? (anything missing from it?)


https://reviews.llvm.org/D44367





More information about the llvm-commits mailing list