<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 10/10/2017 02:49 PM, Alina Sbirlea
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAHk2dbqLB3wiDT_e1uhkTvxH5WZmpTAgZSrSPn+Ai6TfA0XPiA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <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 class="gmail_extra">
                  <div class="gmail_quote">
                    <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>
                    <span class="gmail-">
                      <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>
                    </span>
                    <div>Yes.</div>
                  </div>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>I didn't mean to pick on the example, sorry if that's
              how it came through.</div>
            <div><br>
            </div>
            <div>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.</div>
            <div>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. <br>
            </div>
            <div>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.</div>
            <div><br>
            </div>
            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,</div>
          <div class="gmail_quote">  MRI_MustRef = MRI_Ref | MRI_Must,</div>
          <div class="gmail_quote">  MRI_MustMod = MRI_Mod | MRI_Must,</div>
          <div class="gmail_quote">  MRI_MustModRef = MRI_ModRef |
            MRI_Must<br>
            };</div>
          // + shift values in FunctionModRefLocation to 8, 16, 32.</div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">Recursive masking of MRI_Ref/MRI_Mod
          would get replaced by MRI_MustRef/MRI_MustMod.</div>
        <div class="gmail_extra">But the top of the lattice is still
          MRI_ModRef.</div>
        <div class="gmail_extra">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.</div>
      </div>
    </blockquote>
    <br>
    I don't see this as a major problem. Please feel free to fix these
    places by replacing the equality checks with mask checks.<br>
    <br>
     -Hal<br>
    <br>
    <blockquote
cite="mid:CAHk2dbqLB3wiDT_e1uhkTvxH5WZmpTAgZSrSPn+Ai6TfA0XPiA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">So I guess my question is, what's the
          right approach here? I feel like I'm not on the right path.</div>
        <div class="gmail_extra">
          <div class="gmail_quote"><br>
          </div>
          <div class="gmail_quote">
            <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 class="gmail_extra">
                  <div class="gmail_quote"><span class="gmail-">
                      <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>
                    </span>
                    <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>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>Yes, that's what I meant. In getModRefInfo(CS, Loc)
              there is a loop over all args, it checks alias() for each
              one.</div>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
  </body>
</html>