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

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 17:36:48 PDT 2016


hfinkel 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.
+
----------------
pcc wrote:
> 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.
Ah, so it only applies to constants right now, not to actual GEP instructions. I see what you mean now, but when I originally read the text, I thought that you meant that the index expression needed to be constant, not that the entire GEP needed to be a constant.


https://reviews.llvm.org/D22793





More information about the llvm-commits mailing list