<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Aug 19, 2007, at 1:15 PM, Gordon Henriksen wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV><DIV>On 2007-08-19, at 15:41, Duncan Sands wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">can you please explain more about what restrict means: it may help in improving code quality for Ada.  In Ada you have runtime constants that are really constant, for example array bounds.  The bounds are passed around by pointer, which causes LLVM to think they may be aliased and changed by function calls (which is impossible).  This results on rotten code since (for example) the array length and bounds checks are recalculated again and again when one calculation would do.  [The front-end outputs a bound check for every array access, expecting the optimizers to remove redundant checks, which LLVM often does not do].  If I could teach LLVM that array bounds are really constant that would presumably solve the problem.</SPAN></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The benefits of a const * __restrict come from two different places. The const part is essentially enforced by the front-end and the restrict part is used to inform the alias analysis (it becomes a noalias parameter attribute). The noalias parameter attribute may be of use to you eventually, but full noalias implementation isn't yet complete. Specifically the case where a function with noalias parameter attributes is inlined does not currently preserve the noalias information.</DIV><BR><BLOCKQUOTE type="cite"><DIV></DIV><DIV>Here's a thread about it:</DIV><DIV><BR class="webkit-block-placeholder"></DIV><DIV><A href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-March/thread.html#8291">http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-March/thread.html#8291</A></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>You should also take a look at PR 1373, as that is where progress is being tracked. <A href="http://llvm.org/bugs/show_bug.cgi?id=1373">http://llvm.org/bugs/show_bug.cgi?id=1373</A></DIV><DIV><BR><BLOCKQUOTE type="cite"><DIV>I don't think anything has been implemented.</DIV> </BLOCKQUOTE><BR></DIV><DIV>Per the discussion and PR there has been work done to implement the 'noalias' parameter attribute in LLVM, and currently BasicAA will use this attribute to inform alias queries that are made. There has also been work to map __restrict C/C++ pointer and reference parameters onto the noalias parameter attribute. There is still much work to be done to fully implement noalias in LLVM, notably the intrinsic and updates to tolerate/use it, as well as to fully support all uses of the __restrict qualifier in the C/C++ front end.</DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>--</DIV><DIV>Christopher Lamb</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><BR></BODY></HTML>