<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="moz-cite-prefix">On 2/19/20 1:16 AM, Doerfert, Johannes via llvm-dev wrote:<br>
</div>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On 02/19, Juneyoung Lee via llvm-dev wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Hello,

</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap=""> Would it be correct to resolve this by saying that dereferenceable(N)
*implies* not_poison? This would be helpful as a clarification of how
it all fits together.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Yes, I think it makes sense.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
I don't we should do that.

Take the `gep inbounds` example:

char* foo(char *arg) {
  return `gep inbounds %arg, -100`
}

Here it depends if we want to deduce the output is dereferenceable(100)
or not. If we do, we need dereferenceable to mean poison if violated, as
with nonnull, because it is derived from poison. Only if we don't derive
dereferenceable for the return value we can go for dereferenceable
violations are UB.</pre>
</blockquote>
<p><br>
</p>
<p>Can you please clarify what it means for the output of dereferenceable to be poison? If we tag a memory address as dereferenceable, is the optimizer free to insert a load of the address immediately following that? Or we need to see some other access (prior
 to any thread synchronization?) to say that's valid?</p>
<p>Thanks again,</p>
<p>Hal<br>
</p>
<p><br>
</p>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">

In the end, I think, it boils down to the question if there are
situations where violation of some attributes should be poison and
violation of others should be UB. If such situations exists it is
unclear to me what makes the UB/poison ones special.


</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On Wed, Feb 19, 2020 at 12:14 PM Nicolai Hähnle <a class="moz-txt-link-rfc2396E" href="mailto:nhaehnle@gmail.com"><nhaehnle@gmail.com></a> wrote:

</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On Wed, Feb 19, 2020 at 3:51 AM Juneyoung Lee via llvm-dev
<a class="moz-txt-link-rfc2396E" href="mailto:llvm-dev@lists.llvm.org"><llvm-dev@lists.llvm.org></a> wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">I think not_poison (Johannes's used keyword) makes sense. We can
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">simulate the original UB semantics by simply attaching it, as explained.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">For the attributes other than nonnull, we may need more discussion;
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">align attribute seems to be okay with defining it as poison,
dereferenceable may need UB even without nonnull (because it needs to be
non-poison as shown Nuno's hoisting example).

For reference, the hoisting example was:

f(dereferenceable(4) %p) {
  loop() {
    %v = load %p
    use(%v)
  }
}
=>
f(dereferenceable(4) %p) {
  %v = load %p
  loop() {
    use(%v)
  }
}

Would it be correct to resolve this by saying that dereferenceable(N)
*implies* not_poison? This would be helpful as a clarification of how
it all fits together.

Cheers,
Nicolai

</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">

-- 

Juneyoung Lee
Software Foundation Lab, Seoul National University
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">

</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>