Hi Duncan. I have strange problems with you mailbox, my posts are lost sometimes on this way. I just want to duplicate answer on your question in this thread: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120305/138785.html ConstantRange has a little bit another purposes. It is not a classical range. Yes it has Lower and Upper, but "sub" and "add" operations are differs from "difference" and "union" set operations. But it is still possible to replace Range class with the ConstantRange, though we need to implement classical set operations to do it. -Stepan.
Hi Stepan,> Hi Duncan. I have strange problems with you mailbox, my posts are lost sometimes on this way.OK, sorry about that. Do you have any details?> I just want to duplicate answer on your question in this thread: > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120305/138785.html > > ConstantRange has a little bit another purposes. It is not a classical range.How do you mean? It looks like a classical range to me! Yes it has Lower and Upper, but "sub" and "add" operations are differs from "difference" and "union" set operations. It has intersectWith and unionWith, so I'm not sure what you mean here. There is also "inverse" for forming the complement. But it is still possible to replace Range class with the ConstantRange, though we need to implement classical set operations to do it. The basic set operations are already implemented as I mentioned above, though you might want to add some convenience methods like symmetric difference. Ciao, Duncan.
Hi, Duncan. unionWith result is differs from set union, since it produces single set always while set operations may produce two sets. E.g.: For ranges [1, 5) and [10,15) unionWith produces [1,15), while set union should just keep these sets without changing, probably with indication that sets are not intersected. Implementation of set union is simple though. The "symmetric difference" implementation is little bit more complex. For two sets [1,15) and [7,12) symmetric difference is pair of ranges: [1,7) and [12,15) I propose to implement these methods in ConstantRange (I can do it). -Stepan.