<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Personally, I'm in the "strip like
metadata" camp. This is much easier to reason about.<br>
<br>
Philip<br>
<br>
On 02/03/2017 07:50 AM, Reid Kleckner via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:CACs=tyJCLT8CHDH0CS+aqdQNPThbJbLKb9fobn3dq0b_qYwO6A@mail.gmail.com"
type="cite">
<div dir="auto">Just yesterday I talked to Dan Gohman, who
suggested we strip nowrap flags when speculating. It solves a
lot of poison problems.</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Feb 3, 2017 5:49 AM, "Hal Finkel via
llvm-dev" <<a moz-do-not-send="true"
href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On 02/03/2017 07:28 AM, Artur Pilipenko wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm looking at the bug (<a moz-do-not-send="true"
href="https://llvm.org/bugs/show_bug.cgi?id=31181"
rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bu<wbr>g.cgi?id=31181</a>)
which was triggered by my change to make CVP mark adds as
no wrap (<a moz-do-not-send="true"
href="https://reviews.llvm.org/rL278220"
rel="noreferrer" target="_blank">https://reviews.llvm.org/rL27<wbr>8220</a>)
and I'd like to have some broader discussion of the
problem. In this bug CVP correctly marks an add as nuw
basing on the loop latch check, but later loop rotation
pass moves the add to a point before the check. In the new
context nuw is no longer valid and leads to an incorrect
transformation of the loop. See <a moz-do-not-send="true"
href="https://llvm.org/bugs/show_bug.cgi?id=31181#c5"
rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug<wbr>.cgi?id=31181#c5</a>
comment in the bug for more details.<br>
<br>
Since nsw, nuw flags can be control dependent, it seems
like we should be treating them as metadata, i.e. we
should be stripping them when we speculate the
instruction. I don’t think that we are doing this now
anywhere. The problem was noticed on loop rotation, but I
expect any other pass which speculates overflowing
operations is suffering from the same problem.<br>
<br>
Thoughts?<br>
</blockquote>
<br>
We generally don't strip these because violating the
wrapping constraint does not immediately cause UB. Instead,
it generates a poison value. So long as that poison value is
not used in way which causes UB, then everything is fine. In
this case, I suspect that we want to fix IndVars to strip
the flag, or not do the transformation, when it might
introduce this kind of issue (i.e. a situation where we
might branch on a poison value).<br>
<br>
-Hal<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Artur<br>
</blockquote>
<br>
-- <br>
Hal Finkel<br>
Lead, Compiler Technology and Programming Languages<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a moz-do-not-send="true"
href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a moz-do-not-send="true"
href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<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="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>