<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 28, 2021 at 5:44 PM Johannes Doerfert via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 3/28/21 3:49 AM, James Courtier-Dutton wrote:<br>
> Actual use cases can get much more complicated with for example,<br>
> non-contiguous ranges. e.g. 0,1,4,5 ok, but 2,3,6,7 not ok.<br></blockquote><div><br></div><div>This can actually be represented by !range metadata, but only for constant values.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
That said, in operand bundles we can generally allow non-constant<br>
values, e.g., `["range"(%p, i32 0, i32 %N)]`<br></blockquote><div><br></div><div>That's a good point and it essentially disqualifies !range metadata if we want to one day be able to deal with values..</div><div> </div><div><div></div><div>> This means we have to handle multiple variants across the codebase, which can lead to situations where only one or the other is handled<br></div><div><br></div><div>I don't think this is really an issue, because whatever the choice of representation is, all these variants should be using `ValueTracking` to abstract the representation anyway.</div></div><div><br></div><div>> I'm not sure I understand the questions properly. It basically is range metadata attached to an arbitrary value for a fixed program point. Could you elaborate on your comments wrt. the connection to option 2 and 3, please.</div><br>It's just that I was not sure about the internal representation, but you've answered by question: It's internally a different concept from !range metadata, so I'll need to teach ValueTracking about it.<br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
~ Johannes<br>
<br>
<br>
> Kind Regards<br>
><br>
> James<br>
><br>
><br>
><br>
><br>
>>>>>> On 3/24/21 9:06 AM, Clement Courbet wrote:<br>
>>>>>>> On Wed, Mar 24, 2021 at 2:20 PM Johannes Doerfert <<br>
>>>>>>> <a href="mailto:johannesdoerfert@gmail.com" target="_blank">johannesdoerfert@gmail.com</a>> wrote:<br>
>>>>>>><br>
>>>>>>>> I really like encoding more (range) information in the IR,<br>
>>>>>>>> more thoughts inlined.<br>
>>>>>>>><br>
>>>>>>>> On 3/24/21 4:14 AM, Clement Courbet via llvm-dev wrote:<br>
>>>>>>>>> struct Histogram {<br>
>>>>>>>>><br>
>>>>>>>>>      int values[256];<br>
>>>>>>>>><br>
>>>>>>>>>      int total;<br>
>>>>>>>>><br>
>>>>>>>>> };<br>
>>>>>>>>><br>
>>>>>>>>> Histogram DoIt(const int* image, int size) {<br>
>>>>>>>>><br>
>>>>>>>>>      Histogram histogram;<br>
>>>>>>>>><br>
>>>>>>>>>      for (int i = 0; i < size; ++i) {<br>
>>>>>>>>><br>
>>>>>>>>>        ++histogram.values[image[i]];  // (A)<br>
>>>>>>>>><br>
>>>>>>>>>        ++histogram.total;             // (B)<br>
>>>>>>>>><br>
>>>>>>>>>      }<br>
>>>>>>>>><br>
>>>>>>>>>      return histogram;<br>
>>>>>>>>><br>
>>>>>>>>> }<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>