<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 10, 2017 at 10:19 AM, Alina Sbirlea <span dir="ltr"><<a href="mailto:alina.sbirlea@gmail.com" target="_blank">alina.sbirlea@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm trying to understand what is the result we'd seek in the example in D38569 (pasting here for quick access)<div><div class="gmail-m_-3001469650392112633m_-7568827632046758897gmail-remarkup-code-block" style="margin:12px 0px;padding:0px;border:0px;white-space:pre-wrap;color:rgb(146,150,157);font-family:"Segoe UI","Segoe UI Emoji","Segoe UI Symbol",Lato,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px"><pre class="gmail-m_-3001469650392112633m_-7568827632046758897gmail-remarkup-code" style="margin-top:0px;margin-bottom:0px;padding:12px;border:0px;background:rgba(71,87,120,0.08);color:rgb(0,0,0);overflow:auto;border-radius:3px;white-space:pre-wrap;font-stretch:normal;font-size:11px;line-height:15px;font-family:Menlo,Consolas,Monaco,monospace">double f(double a)
{
double b;
double c,d;
double (*fp) (double) __attribute__ ((const));
/* Partially redundant call */
if (a < 2.0)
{
fp = sin;
c = fp (a);
}
else
{
c = 1.0;
fp = cos;
}
d = fp (a);
return d + c;
}</pre></div><p style="margin:0px;padding:0px;border:0px;color:rgb(146,150,157);font-family:"Segoe UI","Segoe UI Emoji","Segoe UI Symbol",Lato,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px">the fp call will get pushed into the else branch.<br style="margin-top:0px">In the equivalent loop, we could promote it (PRE could promote it too if you let it speculate)<br>If we determine it is a must-alias of a single thing, we could do the same.<br>If we determine it's a must-alias of a set of things, we could do the same <br>If we determine it's a must-alias of the live on entry def, etc</p><p style="margin:0px;padding:0px;border:0px;color:rgb(146,150,157);font-family:"Segoe UI","Segoe UI Emoji","Segoe UI Symbol",Lato,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px"><br></p><br>If I understand correctly, the necessary info for fp in this example is:</div><div>isMustAlias (CallSite argument a, Value a) && getModRefBehavior(CallSite)==o<wbr>nlyReadsMemory.<br>So adding a MRI_MustMod is insufficient?</div></div></blockquote><div>Sigh</div><div>I should have taken the time to give a better example.</div><div>The must-alias part is irrelevant to an example (it only requires read-onlyness)</div><div><br></div><div>You said "LICM doesn't move calls, so we'd never really care about must-alias for promotion". I was just pointing out other things move calls any may want to know.</div><div> </div><div>If you want an example where the must-alias part would matter:</div><div><br></div><div>*a = something</div><div>foo(a)</div><div>b = *a<br></div><div><br></div><div>If foo mustalias a (and only a) not only can you move foo with a, you can actually clone foo here, change it to be pass-by-value, and promote the argument inside of it (if you wanted to).</div><div><br></div><div>So you can use this info to, for example, do interprocedural promotion.</div><div><br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Are we instead looking to set a MRI_Must bit, disjunct of MRI_Mod, and test for MRI_Ref&MRI_Must or MRI_Mod&MRI_Must?</div></div></blockquote><div><br></div><div>Yes.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">In getModRefInfo(CS, Loc), the MRI_Must bit would then be set if doesAccessArgPointees and ArgAlias == MustAlias for all Args, which seems correct.</div></blockquote><div><br></div><div><br></div><div>alias == MustAlias for Loc, not for all args.</div><div>(IE It it returns a singular result about Loc, not a result about all args)</div><div><br></div><div>To get the set answer for all args, we'd have to query further.</div><div><br></div></div></div></div>