<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_quote"><div class="">In any case, George, want to put "update ptrtoint/inttoptr to wait until it sees an operation happen on the the pointer before declaring it bad" on the list of stuff to do?</div></div></div></blockquote><div class=""><br class=""></div><div class=""><a href="https://llvm.org/bugs/show_bug.cgi?id=22927" class="">https://llvm.org/bugs/show_bug.cgi?id=22927</a> :)</div><div class=""><br class=""></div><div class="">George</div><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 16, 2015, at 4:09 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org" class="">dberlin@dberlin.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><br class=""><div class="gmail_quote">On Mon, Mar 16, 2015 at 12:51 PM Olivier Sallenave <<a href="mailto:ol.sall@gmail.com" class="">ol.sall@gmail.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Daniel,<div class=""><br class=""></div><div class="">You said "more advanced AA's like CFL-AA will give up on anything that comes from or goes through ptrtoint/inttoptr": indeed using CFL-AA doesn't solve the noalias problem here.<br class=""></div><div class=""><br class=""></div><div class="">But do you know why it would give up? I would understand if there was any pointer arithmetic, but for trivial inttoptr/ptrtoint it should just propagate the noalias information correctly.</div></div></blockquote><div class=""><br class=""></div><div class="">It could, as long as it was directly intoptr/ptrtoint, not give up.</div><div class=""><br class=""></div><div class="">But here you have a further problem:<br class="">You are calling intoptr on an argument.</div><div class="">In general, it has no idea where this argument came from.</div><div class="">It has no idea what this int points to.</div><div class="">It can't say anything reasonable about it other than "no idea".</div><div class=""><br class=""></div><div class="">If it sees the call and the callee, interprocedural analysis could try to do something, but you are still going to have bad results in the non-LTO case (and even then, in the non-whole-program case)</div><div class=""><br class=""></div><div class="">This will be true of *all* pointer analysis,  not just CFL-AA.<br class=""></div><div class=""><br class=""></div><div class="">In any case, George, want to put "update ptrtoint/inttoptr to wait until it sees an operation happen on the the pointer before declaring it bad" on the list of stuff to do?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""> <br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Finally, very naive question here: why isn't CFL-AA used by default? Is that kind of experimental so far?</div></div></blockquote><div class=""><br class="">There are some bugs remaining to be worked out, and then tuning likely needs to happen  in other passes . When you give better AA answers than you had before, and increase freedom for optimizers/scheduling/regalloc to do things, the initial results tend to be negative because they become over-aggressive :)</div><div class=""> <br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Olivier</div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">2015-03-16 14:24 GMT-04:00 Reid Kleckner <span dir="ltr" class=""><<a href="mailto:rnk@google.com" target="_blank" class="">rnk@google.com</a>></span>:</div></div><div class="gmail_extra"><div class="gmail_quote"><br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><span class="">On Mon, Mar 16, 2015 at 9:56 AM, Hal Finkel <span dir="ltr" class=""><<a href="mailto:hfinkel@anl.gov" target="_blank" class="">hfinkel@anl.gov</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;" class="">so just using pointer types instead of i64 will help common cases, but will not address the general issue. Now part of this does some down to using array parameters as a substitute for byval/direct parameters. As I recall, this was done because it allowed a natural partial decomposition between GPRs and stack for structures that straddle the number of available parameter-passing GPRs. If we could accomplish that with regular byval parameters and regular direct parameters, then we'd not need any of this array coercion, and the system, including for the purposes of aliasing analysis, would work as intended. There may be some infrastructure work required in the backend (SelectionDAG builder, etc.) -- Uli, if you know please comment -- but I think moving away from the array coercions might be the right solution, even if that requires some infrastructure enhancements.<br class=""></div></div></blockquote><div class=""><br class=""></div></span><div class="">So, every backend interprets 'byval' differently, but it usually means "pass this whole thing in stack memory". It also requires extra copies through memory at the IR level, so I don't think we should be moving towards this construct.</div><div class=""><br class=""></div><div class="">If you want to pass things in registers, it's usually best to use SSA values. Even though the extra 'extractvalue' instructions look expensive in the IR, they lower down to simple virtual register copies in the selection dag. The shift and trunc, on the other hand, don't model the machine code at all, and it would be good if we could eliminate them.</div><div class=""><br class=""></div><div class="">I wonder if we could solve this parameter alignment problem via the 'align' parameter attribute. Unfortunately, I think for pointer types it's already overloaded to describe the alignment of the pointee and not the argument itself. In fact, I think you did this Hal. :)</div><div class=""><br class=""></div><div class="">I think, in the long term, we should probably use a direct FCA. I believe this is what ARM does. It's also nice to flatten the FCA if we can detect that we're in a simple case where no interesting alignment is required.</div></div></div></div>
</blockquote></div></div></blockquote></div></div>
</div></blockquote></div><br class=""></body></html>