<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>Hi Wei Wei,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>You’re correct.  The addLoopCarriedDependences function is creating loop carried store->load dependences only.  The other dependences you’ve listed need to be added as well for correctness.  The missing dependences are just an oversight.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>Brendon<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> wei wei [mailto:wweiandrew@gmail.com] <br><b>Sent:</b> Thursday, August 17, 2017 10:50 AM<br><b>To:</b> bcahoon@codeaurora.org<br><b>Cc:</b> llvm-dev@lists.llvm.org<br><b>Subject:</b> Missing some cross iteration memory dependencies for software pipeline?<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Hi, bcahoon,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I found in Machinepipeliner, addLoopCarriedDependences function only create store-->load true mem dependence when identifying recurrences.<o:p></o:p></p></div><div><p class=MsoNormal>But in ScheduleDAGInstrs, there may be three kinds of mem order dependencies(store-->load, load-->store, store-->store) inside one iteration.<o:p></o:p></p></div><div><p class=MsoNormal>When calculating loop carried dependence, in addition to register dependence(phis), we also need to consider the above three kinds of memory dependencies to build cross iterations graph.<o:p></o:p></p></div><div><p class=MsoNormal>For example,<o:p></o:p></p></div><div><p class=MsoNormal>    STORE Reg1, Reg0 + Offset0      //INSN_A<o:p></o:p></p></div><div><p class=MsoNormal>    ... ...<o:p></o:p></p></div><div><p class=MsoNormal>    STORE Reg3, Reg2 + Offset2      //INSN_B<o:p></o:p></p></div><div><p class=MsoNormal>If INSN_A-->INSN_B(<b>store-->store</b>) had  mem order dependence inside the iteration(Assuming that alias analysis result for the addresses Reg0 + Offset0/Reg2 + Offset2 were dependent)<o:p></o:p></p></div><div><p class=MsoNormal>For  cross iteration dependence, INSN_B-->INSN_A must have mem order dependence too.<o:p></o:p></p></div><div><p class=MsoNormal>So I wonder why in current implementation of swp, there're no enough mem loop carried dependence? will it cause some correct problems?<o:p></o:p></p></div><div><p class=MsoNormal>Also, I checked SMS pass in GCC, and found that DDG graph will construct correct cross iteration memory dependence(store-->load, load-->store, store-->store)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Thanks,<o:p></o:p></p></div><div><p class=MsoNormal>Wei Wei<o:p></o:p></p></div></div></div></body></html>