<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 01/08/2015 11:32 AM, Sanjay Patel
wrote:<br>
</div>
<blockquote
cite="mid:CA+wODisfwWCTsQXh0Gt4hr_zRB-TfmgeMf_7jT_vTB0aPEMvDA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><a moz-do-not-send="true"
href="http://llvm.org/bugs/show_bug.cgi?id=17713">http://llvm.org/bugs/show_bug.cgi?id=17713</a>
shows another case where some kind of FP value tracking would
be useful.<br>
<br>
</div>
gcc can transform this division into multiplication by
reciprocal:<br>
<pre class="" id="comment_text_0"> if (y == 2.0) return x/y;</pre>
</div>
</blockquote>
Just to note, this is probably a different case than eliminating
range checks. I'm really surprised that GVN and/or JumpThreading
(via LVI Constant) doesn't get this though. Propagating a constant
along an edge is pretty much independent of any floating point
semantics. <br>
<br>
In fact, looking at LVI, this looks *really* simple to add. See the
first check in getEdgeValueLocal. We're talking probably 20 LOC
(assuming it doesn't flush out other bugs.)<br>
<br>
I haven't glanced at the GVN case.<br>
<br>
<br>
<blockquote
cite="mid:CA+wODisfwWCTsQXh0Gt4hr_zRB-TfmgeMf_7jT_vTB0aPEMvDA@mail.gmail.com"
type="cite">
<div dir="ltr"><br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Jan 8, 2015 at 12:02 PM, Hal
Finkel <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><span
class="">----- Original Message -----<br>
> From: "Arch Robison" <<a moz-do-not-send="true"
href="mailto:arch.robison@intel.com">arch.robison@intel.com</a>><br>
> To: "Philip Reames" <<a moz-do-not-send="true"
href="mailto:listmail@philipreames.com">listmail@philipreames.com</a>>,
<a moz-do-not-send="true"
href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>
> Sent: Thursday, January 8, 2015 12:54:32 PM<br>
> Subject: Re: [LLVMdev] Floating-point range checks<br>
><br>
><br>
</span><span class="">> Thanks for the pointers. Looks
like LazyValueInfo has the sort of<br>
> infrastructure I had in mind. LVILatticeVal could be
extended to<br>
> floating point. (The comment “this can be made a lot
more rich in<br>
> the future” is an invitation :-). I’m thinking a
simple lattice<br>
> would address most cases of interest for
floating-point checks. The<br>
> lattice points for floating-point could be all
subsets of the<br>
> eight-element set:<br>
><br>
> {-inf,<0,-0,+0,>0,+inf,-nan,+nan},<br>
><br>
> where <0 and >0 denote finite negative/positive
numbers respectively.<br>
><br>
<br>
</span>I'm not sure. Checks against 1.0 are also common. Why
not just add a FP range class, like our constant range, and
go from there?<br>
<br>
-Hal<br>
<div class="HOEnZb">
<div class="h5"><br>
><br>
><br>
> - Arch<br>
><br>
><br>
><br>
><br>
><br>
> From: Philip Reames [mailto:<a
moz-do-not-send="true"
href="mailto:listmail@philipreames.com">listmail@philipreames.com</a>]<br>
> Sent: Wednesday, January 7, 2015 6:03 PM<br>
> To: Robison, Arch; <a moz-do-not-send="true"
href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>
> Subject: Re: [LLVMdev] Floating-point range checks<br>
><br>
><br>
><br>
> I don't believe we have much in this area
currently.<br>
><br>
> Generally, something like this would existing in
InstCombine and<br>
> ValueTracking.<br>
><br>
> Take a look at ComputeSignBit in ValueTracking.cpp.
This doesn't<br>
> apply (?) to floating point numbers, but we'd need
something<br>
> equivalent for them. It looks like there may
already be a start in<br>
> the form of:<br>
> CannotBeNegativeZero<br>
><br>
> Other places to look would be SimplifyFAdd and<br>
> InstCombine::visitFAdd.<br>
><br>
> For this particular example, you're probably going
to want a pattern<br>
> in SimplifyFCmp of the form:<br>
> matcher: sqrt_call( fadd(Value(X),
SpecificValue(X)), fadd(Value(Y),<br>
> SpecificValue(Y)))<br>
> && CannotBeNegativeZero(X) &&
CannotBeNegativeZero(Y)<br>
><br>
> You might also look at LazyValueInfo, but that's
probably of<br>
> secondary interest. It's purely in terms of
constant integer ranges<br>
> currently.<br>
><br>
> Philip<br>
><br>
><br>
><br>
><br>
><br>
> On 01/07/2015 02:13 PM, Robison, Arch wrote:<br>
><br>
><br>
><br>
><br>
> The Julia language implements sqrt(x) with
conditional branch taken<br>
> if x<0. Alas this prevents vectorization of
loops with sqrt. Often<br>
> the argument can be proven to be non-negative.
E.g., sqrt(x*x+y*y).<br>
> Is there an existing LLVM pass or analysis that
does floating-point<br>
> range propagation to eliminate such unnecessary
checks?<br>
><br>
><br>
><br>
><br>
><br>
> Arch D. Robison<br>
><br>
><br>
> Intel Corporation<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________
LLVM Developers<br>
> mailing list <a moz-do-not-send="true"
href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>
<a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu"
target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a moz-do-not-send="true"
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev"
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a moz-do-not-send="true"
href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>
<a moz-do-not-send="true"
href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a moz-do-not-send="true"
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev"
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
<br>
</div>
</div>
<span class="HOEnZb"><font color="#888888">--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</font></span>
<div class="HOEnZb">
<div class="h5"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a moz-do-not-send="true"
href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>
<a moz-do-not-send="true"
href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a moz-do-not-send="true"
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev"
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>