<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 28, 2017 at 3:55 PM, 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"><span class="gmail-"><div>> <span style="color:rgb(80,0,80)">In your new proposal, doing & on the result of getModRef() may yield unexpected results.</span></div></span><div><font color="#500050">Agreed. I made the change I proposed locally, and, while it simplifies some cases, it makes other bit-wise operations look unintuitive.</font></div><span class="gmail-"><div><font color="#500050"><br></font></div><div><span style="color:rgb(80,0,80)">> </span>Maybe we should just hide all that in inline functions or something and make it an enum class</div></span><div>Noted, and looking into this option. Hoping a couple of static functions (e.g. mods(), refs(), isMust(), addMust()) will be more intuitive than the bit-wise ops.</div><div>Should also make it easier to understand and prove.</div></div></blockquote><div><br></div><div>All,</div><div><br></div>I put <a href="https://reviews.llvm.org/D40749">D40749</a> up for review. It's only a NFC and adding the Must bit can be rebased on top of it.</div><div class="gmail_quote"><br></div><div class="gmail_quote">It does not do full replacement of bit-wise operations across all AAs, but I'm hoping to get some feedback on the approach, and I can update the patch to add the changes for the other AAs.<br>
<div>Thanks,</div><div>Alina</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><div class="gmail-h5"><div><br></div><div class="gmail-m_8192533939942969720gmail-HOEnZb"></div><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 28, 2017 at 8:42 AM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</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">Maybe we should just hide all that in inline functions or something and make it an enum class<div class="gmail-m_8192533939942969720gmail-HOEnZb"><div class="gmail-m_8192533939942969720gmail-h5"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 28, 2017, 7:28 AM Nuno Lopes <<a href="mailto:nunoplopes@sapo.pt" target="_blank">nunoplopes@sapo.pt</a>> wrote:<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 lang="EN-US"><div class="gmail-m_8192533939942969720gmail-m_-8933893986026200991m_-5993853396239775356WordSection1"><p class="MsoNormal">Just to be clear: I don<span style="font-family:"Times New Roman",serif">’</span>t have any particular concerns regarding your patch. I just did a cursory review and apart of the minor comment I left in Phabricator it looks good. AFAIU your goal is to pick a good combination of values in the enum to make the implementation simpler & correct. I don<span style="font-family:"Times New Roman",serif">’</span>t know enough about this specific code to help with this respect.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">My concern was with the users of getModReg(). In your new proposal, doing & on the result of getModRef() may yield unexpected results.<u></u><u></u></p><p class="MsoNormal"> E.g., <span style="font-family:"Times New Roman",serif">“</span>getModRef() & MRI_MustMod != 0<span style="font-family:"Times New Roman",serif">”</span> doesn<span style="font-family:"Times New Roman",serif">’</span>t imply that the instruction will write because the result might have been MRI_Mod (= NoModRef | MustMod).<u></u><u></u></p><p class="MsoNormal">As long as this fact is properly document, I<span style="font-family:"Times New Roman",serif">’</span>m good :) (btw, thanks for fixing the documentation of the old MRI_* values; it was really misleading).<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Nuno<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">P.S.: BTW, not sure I mentioned this to you at the LLVM conf, but my interest in this area is because I<span style="font-family:"Times New Roman",serif">’</span>ve built a little tool to automatically verify correctness of alias analyses (think of Alive for AA/ModRef). Since I<span style="font-family:"Times New Roman",serif">’</span>m not an expert in this area, I need to ask a lot of questions to make sure I<span style="font-family:"Times New Roman",serif">’</span>m proving the right thing :) The script reported a few bugs in BasicAA (mostly for GEPs wo/ inbounds); need to report these..<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><a name="m_8192533939942969720_m_-8933893986026200991_m_-5993853396239775356__MailEndCompose"><u></u> <u></u></a></p><span></span><p class="MsoNormal"><b>From:</b> Alina Sbirlea<br><b>Sent:</b> 27 November 2017 20:02<br><b>To:</b> Nuno Lopes <<a href="mailto:nunoplopes@sapo.pt" target="_blank">nunoplopes@sapo.pt</a>><br><b>Cc:</b> Hal Finkel <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>>; Daniel Berlin <<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>>; George Burgess IV <<a href="mailto:george.burgess.iv@gmail.com" target="_blank">george.burgess.iv@gmail.com</a>>; Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.co<wbr>m</a>></p></div></div><div lang="EN-US"><div class="gmail-m_8192533939942969720gmail-m_-8933893986026200991m_-5993853396239775356WordSection1"><p class="MsoNormal"><br><b>Subject:</b> Re: [llvm-dev] Expose aliasing information in getModRefInfo (or viceversa?)<u></u><u></u></p></div></div><div lang="EN-US"><div class="gmail-m_8192533939942969720gmail-m_-8933893986026200991m_-5993853396239775356WordSection1"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Hi Nuno,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks for taking the time to look over this!<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Here's the reasoning I reached after going over this again.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">> "you can go from MustModRef into Ref or Mod, and that is not true.". <u></u><u></u></p></div><div><p class="MsoNormal">That's correct. While the initial thought I had was "Found may" + "Found must", then we should return "May", that's not the right, we should return "Must". Here's why:<u></u><u></u></p></div><div><p class="MsoNormal">Right now, if one AA returns Ref and another Mod, then we do logical & and return NoModRef, because one AA analysis removed the Mod bit because it was sure there was no Mod, so it returned Ref, while the other was sure there was no Ref and returned Mod. So correct answer is NoModRef.<u></u><u></u></p></div><div><p class="MsoNormal">With the Must bit, the logic should be the same. If one analysis removed the "May" bit, then it's sure there is a Must alias there. Now, by Must alias, I mean all aliases were MustAlias and NoAlias, and no May or PartialAlias was found.<u></u><u></u></p></div><div><p class="MsoNormal">> Therefore, we cannot go from MustModRef into MayRef, because MayRef implies there<span style="font-family:"Times New Roman",serif">’</span>s no write; there<span style="font-family:"Times New Roman",serif">’</span>s at most a read.<u></u><u></u></p></div><div><p class="MsoNormal">Exactly, from MustModRef, we should have no reason to go into MayRef. Logical & here will give MustRef. This case should be when one analysis finds "I'm sure there is a must alias, not sure if I can remove either mod or ref so will conservatively say both", and the second says "I only know there's no Mod".<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I've been talking here about different AA results. I'll reiterate that within the same analysis, the Must bit should only be cleared if all aliases found MustAlias, otherwise that bit should be conservatively kept set.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">> What confused me first is that Mod has 2 <span style="font-family:"Times New Roman",serif">“</span>mays<span style="font-family:"Times New Roman",serif">”</span>: may read, and if it does it may be to the given location.<u></u><u></u></p></div><p class="MsoNormal">> While MustMod has 2 <span style="font-family:"Times New Roman",serif">“</span>musts<span style="font-family:"Times New Roman",serif">”</span>: must read, and it must read exactly from the given location.<u></u><u></u></p><p class="MsoNormal">><u></u> <u></u></p><div><p class="MsoNormal">> Your lattice doesn<span style="font-family:"Times New Roman",serif">’</span>t have the intermediate values (1 may + 1 must, like MustModMayAlias), but that would increase significantly the size of the lattice. I don<span style="font-family:"Times New Roman",serif">’</span>t know which clients would benefit of that precision increase (if any) <span style="font-family:"Times New Roman",serif">–</span> didn<span style="font-family:"Times New Roman",serif">’</span>t think about that.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">True, such info would increase the size of the lattice a lot. Going into MustMod is meant as the certainty you mentioned: it must read and it must be exactly that location. Anything less than that will conservatively be Mod.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Does this make sense?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks,<u></u><u></u></p></div><div><p class="MsoNormal">Alina<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Thu, Nov 23, 2017 at 3:47 AM, Nuno Lopes <<a href="mailto:nunoplopes@sapo.pt" target="_blank">nunoplopes@sapo.pt</a>> wrote:<u></u><u></u></p><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal">Hi Alina,<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">My only concern with that design is that it seems that you can go from MustModRef into Ref or Mod, and that is not true.<u></u><u></u></p><p class="MsoNormal">Assuming my understanding of what ModRef & friends mean is correct, this is the lattice (where green are the official names, and black are my comments): <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><img border="0" width="599" height="203" style="width: 6.2361in; height: 2.118in;" id="gmail-m_8192533939942969720gmail-m_-8933893986026200991i1600381cf366917eb1" src="cid:1600381cf366917eb1" class="gmail-m_8192533939942969720gmail-m_-8933893986026200991nativeView"><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">AFAIU, MustModRef means that an operation *<b>must</b>* read and write to the given location. Moreover, it *<b>must</b>* alias with that allocation.<u></u><u></u></p><p class="MsoNormal">Therefore, we cannot go from MustModRef into MayRef, because MayRef implies there<span style="font-family:"Times New Roman",serif">’</span>s no write; there<span style="font-family:"Times New Roman",serif">’</span>s at most a read.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">What confused me first is that Mod has 2 <span style="font-family:"Times New Roman",serif">“</span>mays<span style="font-family:"Times New Roman",serif">”</span>: may read, and if it does it may be to the given location.<u></u><u></u></p><p class="MsoNormal">While MustMod has 2 <span style="font-family:"Times New Roman",serif">“</span>musts<span style="font-family:"Times New Roman",serif">”</span>: must read, and it must read exactly from the given location.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Your lattice doesn<span style="font-family:"Times New Roman",serif">’</span>t have the intermediate values (1 may + 1 must, like MustModMayAlias), but that would increase significantly the size of the lattice. I don<span style="font-family:"Times New Roman",serif">’</span>t know which clients would benefit of that precision increase (if any) <span style="font-family:"Times New Roman",serif">–</span> didn<span style="font-family:"Times New Roman",serif">’</span>t think about that.<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Nuno<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><a name="m_8192533939942969720_m_-8933893986026200991_m_-5993853396239775356_m_-6224348830366553652__MailEndCompose"> </a><u></u><u></u></p><p class="MsoNormal"><b>From:</b> Alina Sbirlea<br><b>Sent:</b> 22 November 2017 23:06<br><b>To:</b> Hal Finkel <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>>; Daniel Berlin <<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>>; George Burgess IV <<a href="mailto:george.burgess.iv@gmail.com" target="_blank">george.burgess.iv@gmail.com</a>>; llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>; Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.co<wbr>m</a>><br><b>Subject:</b> Re: [llvm-dev] Expose aliasing information in getModRefInfo (or viceversa?)<u></u><u></u></p><div><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">Re-opening this discussion, to get some feedback.<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Adding alias info is under review in <a href="https://reviews.llvm.org/D38862" target="_blank">https://reviews.llvm.org/D3<wbr>8862</a>.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">An issue that came up, that was bugging me before is how to reason of what is top/bottom of the lattice, and what is the default to test against.<u></u><u></u></p></div><div><p class="MsoNormal">So talking offline is Sanjoy, we reached a slightly different conclusion which makes more sense to me.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Current patch has:<u></u><u></u></p></div><div><div><p class="MsoNormal"><span style="font-size:9.5pt">enum ModRefInfo {<br> MRI_NoModRef = 0,<br> MRI_Ref = 1,<br> MRI_Mod = 2,<br> MRI_ModRef = MRI_Ref | MRI_Mod,<br> MRI_Must = 4,</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_MustRef = MRI_Ref | MRI_Must,</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_MustMod = MRI_Mod | MRI_Must,</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_MustModRef = MRI_ModRef | MRI_Must<br>};</span><u></u><u></u></p></div></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">Proposed change:</span><u></u><u></u></p></div><div><div><p class="MsoNormal"><span style="font-size:9.5pt">enum ModRefInfo {</span><u></u><u></u></p></div><div><div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_Must = 0,</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_MustRef = 1,</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_MustMod = 2,</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_MustModRef = MRI_MustRef | MRI_MustMod</span><u></u><u></u></p></div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_NoModRef = 4,<br> MRI_Ref = MRI_NoModRef | MRI_MustRef , /* Same semantics as right now, i.e. MayRef */</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_Mod = MRI_NoModRef | MRI_MustMod , /* Same semantics as right now, i.e. MayMod */</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> MRI_ModRef = MRI_Ref | MRI_Mod, /* Same semantics as right now, i.e. May Ref or Mod */</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">};</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">With this change:</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">- the same approach of "set a bit to 0 when additional info is available" will apply to the Must bit, as it does to Ref and Mod.</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">- we could keep the same checks with MRI_NoModRef</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">- MRI_ModRef remains the most conservative answer (top).</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">- finding MRI_Must gives more info than MRI_NoModRef, so it makes sense to be bottom.</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">- MRI_NoModRef means "no mod or ref, and no must alias".</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">The only obvious change I see right now will be to to add " | MRI_NoModRef", essentially setting the default to "not must alias".</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:black">For GlobalsModRef, we can also always set </span><span style="font-size:9.5pt">MRI_NoModRef bit.</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">I may be missing details here, happy to elaborate.</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">Happy Thanksgiving!</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">Alina</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p></div></div><div><p class="MsoNormal"> <u></u><u></u></p></div></div><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">On Tue, Oct 10, 2017 at 1:13 PM, Alina Sbirlea <<a href="mailto:alina.sbirlea@gmail.com" target="_blank">alina.sbirlea@gmail.com</a>> wrote:<u></u><u></u></p><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"><div><div><p class="MsoNormal"> <u></u><u></u></p><div><div><div><p class="MsoNormal">On Tue, Oct 10, 2017 at 1:05 PM, Hal Finkel <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>> wrote:<u></u><u></u></p><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"><div><div><div><p> <u></u><u></u></p><div><p class="MsoNormal">On 10/10/2017 02:49 PM, Alina Sbirlea wrote:<u></u><u></u></p></div><blockquote style="margin-top:5pt;margin-bottom:5pt"><div><div><div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"><div><div><div><div><p class="MsoNormal">Sigh<u></u><u></u></p></div><div><p class="MsoNormal">I should have taken the time to give a better example.<u></u><u></u></p></div><div><p class="MsoNormal">The must-alias part is irrelevant to an example (it only requires read-onlyness)<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">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.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">If you want an example where the must-alias part would matter:<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">*a = something<u></u><u></u></p></div><div><p class="MsoNormal">foo(a)<u></u><u></u></p></div><div><p class="MsoNormal">b = *a<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">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).<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">So you can use this info to, for example, do interprocedural promotion.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"><div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">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?<u></u><u></u></p></div></div></blockquote><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Yes.<u></u><u></u></p></div></div></div></div></blockquote><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">I didn't mean to pick on the example, sorry if that's how it came through.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Since the consensus is to expose the Must info in ModRefInfo, I'm trying to figure out how to add it in a way that makes sense to me.<u></u><u></u></p></div><div><p class="MsoNormal">The way I see ModRefInfo is designed right now is to lower the lattice to NoModRef as fast as possible (start with ModRef as top, get to NoModRef as bottom). The implementation is based on having either Mod or Ref and masking out everything else. <u></u><u></u></p></div><div><p class="MsoNormal">Introducing a Must bit, means setting it occasionally (since May is conservative) and then preserving it, so the opposite: start lattice at bottom, set to top.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><p class="MsoNormal">What I was trying, that *somewhat* made sense:<br>enum ModRefInfo {<br> MRI_NoModRef = 0,<br> MRI_Ref = 1,<br> MRI_Mod = 2,<br> MRI_ModRef = MRI_Ref | MRI_Mod,<br> MRI_Must = 4,<u></u><u></u></p></div><div><p class="MsoNormal"> MRI_MustRef = MRI_Ref | MRI_Must,<u></u><u></u></p></div><div><p class="MsoNormal"> MRI_MustMod = MRI_Mod | MRI_Must,<u></u><u></u></p></div><div><p class="MsoNormal"> MRI_MustModRef = MRI_ModRef | MRI_Must<br>};<u></u><u></u></p></div><p class="MsoNormal">// + shift values in FunctionModRefLocation to 8, 16, 32.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Recursive masking of MRI_Ref/MRI_Mod would get replaced by MRI_MustRef/MRI_MustMod.<u></u><u></u></p></div><div><p class="MsoNormal">But the top of the lattice is still MRI_ModRef.<u></u><u></u></p></div><div><p class="MsoNormal">While the implementation details *may* be ok to resolve, there are calls checking for equality to MRI_Ref or MRI_Mod (not &), so adding the occasional Must bit seems bad.<u></u><u></u></p></div></div></blockquote><p class="MsoNormal"> <u></u><u></u></p></div></div><p class="MsoNormal">I don't see this as a major problem. Please feel free to fix these places by replacing the equality checks with mask checks.<u></u><u></u></p></div></blockquote><div><p class="MsoNormal"> <u></u><u></u></p></div></div></div><div><p class="MsoNormal">Ok, thank you!<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"><div><p class="MsoNormal" style="margin-bottom:12pt"><span style="color:rgb(136,136,136)"><br><br><span class="gmail-m_8192533939942969720gmail-m_-8933893986026200991m_-5993853396239775356gmail-m-6224348830366553652m-5619189094996677201hoenzb"> -Hal</span></span><br><br><u></u><u></u></p><blockquote style="margin-top:5pt;margin-bottom:5pt"><div><div><p class="MsoNormal">So I guess my question is, what's the right approach here? I feel like I'm not on the right path.<u></u><u></u></p></div><div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"><div><div><div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"><div><p class="MsoNormal">In getModRefInfo(CS, Loc), the MRI_Must bit would then be set if doesAccessArgPointees and ArgAlias == MustAlias for all Args, which seems correct.<u></u><u></u></p></div></blockquote><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">alias == MustAlias for Loc, not for all args.<u></u><u></u></p></div><div><p class="MsoNormal">(IE It it returns a singular result about Loc, not a result about all args)<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">To get the set answer for all args, we'd have to query further.<u></u><u></u></p></div></div></div></div></blockquote><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Yes, that's what I meant. In getModRefInfo(CS, Loc) there is a loop over all args, it checks alias() for each one.<u></u><u></u></p></div></div><p class="MsoNormal"> <u></u><u></u></p></div></div></blockquote><p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p><pre>-- <u></u><u></u></pre><pre>Hal Finkel<u></u><u></u></pre><pre>Lead, Compiler Technology and Programming Languages<u></u><u></u></pre><pre>Leadership Computing Facility<u></u><u></u></pre><pre>Argonne National Laboratory<u></u><u></u></pre></div></blockquote></div><p class="MsoNormal"> <u></u><u></u></p></div></div></blockquote></div><p class="MsoNormal"> <u></u><u></u></p></div></div></div></div></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></blockquote></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>