<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, May 17, 2016 at 8:49 PM Owen Anderson <<a href="mailto:resistor@mac.com">resistor@mac.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On May 16, 2016, at 2:42 PM, Sanjoy Das via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">- Core motivation: why do we even care about optimizing floating</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">  point induction variables?  What situations are they common in?  Do</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">  programmers _expect_ compilers to optimize them well?  (I haven't</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">  worked on our vectorizers so pardon the possibly stupid question)</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">  in the example you gave, why do you need SCEV to analyze the</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">  increment to vectorize the loop (i.e how does it help)?  What are</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">  some other concrete cases you'll want to optimize?</span></div></blockquote></div><br></div><div style="word-wrap:break-word"><div>Graphics shading languages like GLSL or HLSL have floating point types as the “default” types.  Integers weren’t even added until later revisions of GLSL.  In that world, it’s not especially strange to imagine a loop counter written in floating point.</div></div></blockquote><div><br></div><div>But most of those are convertible to integer IVs which as Andy pointed out up the thread is something IndVarSimplify tries to do.</div><div><br></div><div>A potential way to show a motivating use case is what Andy already outlined: cases where non-integer values are fundamentally used as part of the IV.</div><div><br></div><div>Even then, I'd personally want to see further evidence of why the correct solution is to model the floating point IV in SCEV rather than find a more powerful way of converting the IV to an integer that models the non-integer values taken on by the IV. <span style="line-height:1.5">As an example, if the use case is the following code with appropriate flags to relax IEEE semantics so this looks like normal algabra etc:</span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">  for (float f = 0.01f; f < 1.0f; f += 0.01f)</span></div><div><span style="line-height:1.5">    ...</span></div><div><span style="line-height:1.5"><br></span></div><div>I'd rather see us cleverly turn it into:</div><div><br></div><div>  float f = 0.01f;</div><div>  for (int i = 1; i < 100; i += 1, f += 0.01f)</div><div>    ...</div><div><br></div><div>(or whatever the transform would be, I've not spent lots of time thinking about the exact way to map this onto a synthetic "adding that value N times crosses threshold, so let's replace IV with a counter to N")</div><div><br></div><div>-Chandler</div></div></div>