[PATCH] D13677: [IR] Fix bug in `ConstantRange::intersectWith`

Nick Lewycky via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 19:34:04 PDT 2015


On 12 October 2015 at 18:22, Sanjoy Das <sanjoy at playingwithpointers.com>
wrote:

> sanjoy abandoned this revision.
> sanjoy added a comment.
>
> This change is unnecessary and buggy.  I was working under the assumption
> that everything in `X.intersectWith(Y)` has to belong to both `X` and `Y`;
> whereas `X.intersectWith(Y)` is //allowed// to return a superset of the
> actual mathematical intersection of `X` and `Y`.  This change is buggy
> today because it will sometimes return a proper subset of the mathematical
> intersection of `X` and `Y`.
>

I'm thoroughly concerned that neither of us noticed this at first. This
sort of thing calls for an API review.

I just reread the ConstantRange.h comment on intersectWith and it looks
really clear and simple (and contradictory to some things I said on IRC
like "it returns the largest", no it expressly says "guaranteed to ... have
the smallest possible set size ...").

I'm glad though, because I was certain intersectWith was really, really bug
free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151012/8dd5198c/attachment.html>


More information about the llvm-commits mailing list