[PATCH] D22793: IR: Introduce inbounds attribute on getelementptr indices.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 17:29:09 PDT 2016


pcc added inline comments.

================
Comment at: docs/LangRef.rst:7551
@@ +7550,3 @@
+``inrange`` operand. Note that the ``inrange`` keyword is currently only
+allowed in constant expressions.
+
----------------
hfinkel wrote:
> pcc wrote:
> > hfinkel wrote:
> > > I don't think we should limit this to constant expressions. We should be able to use this to model p.x[i] vs. p.y. Removing the restriction to constant expressions will also mean you need to generalize the text about pointer comparisons: instead of saying that all operands must be identical, you'll need to say that the same elements need to be selected (or something like that).
> > Seems reasonable enough, but I'm not sure if I'll have any time soon to implement this for non-constants. Perhaps the non-constant implementation can be a separate patch.
> Aside from the LangRef, what needs to change to allow non-constant indicies? I think they should be allowed, even if taking advantage of them is future work. I don't see anything in the parser changes that forbids them.
We would need printing and parsing support, as well as a bitcode representation for getelementptr instructions (as opposed to only constants) with an inrange annotation. Should be straightforward, but a non-zero amount of work.


https://reviews.llvm.org/D22793





More information about the llvm-commits mailing list