<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<div class="moz-cite-prefix">On 7/1/19 12:04 PM, Danila Malyutin via llvm-dev wrote:<br>
</div>
<blockquote type="cite" cite="mid:MN2PR12MB3840E52E8B0F8A6865E1D480B8F90@MN2PR12MB3840.namprd12.prod.outlook.com">
<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:11.0pt;
font-family:"Calibri",sans-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;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:56.7pt 42.5pt 56.7pt 85.05pt;}
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]-->
<div class="WordSection1">
<p class="MsoNormal">Hello,<br>
<br>
The Machine LICM pass has this comment:<o:p></o:p></p>
<p class="MsoNormal">// If this is done before regalloc, only visit outer-most preheader-sporting<o:p></o:p></p>
<p class="MsoNormal">// loops.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I was wondering why there is such a restriction? This prevents hoisting from the deeply-nested inner loops into the outer loop body, when the hoisted instruction is loop invariant everywhere except the outermost loop. I’ve encountered a
problem that would be solved by such hoisting, however I couldn’t figure out the rationale behind LLVM’s MLICM decision. This change appears to be introduced in 2009 (<a href="https://github.com/llvm/llvm-project/commit/79618d1de89e76b1a23a02e8146057a6a21260db" moz-do-not-send="true">https://github.com/llvm/llvm-project/commit/79618d1de89e76b1a23a02e8146057a6a21260db</a>)
but the only reason stated in the commit message seems to be just simplification/performance related.<br>
<br>
Has anyone tried enabling MLICM for nested loops? Is it a good idea? What are the possible issues?<br>
</p>
</div>
</blockquote>
<p><br>
</p>
<p>Hoisting from inner loops into outer loops certainly seems desirable in general. Aside from the compile-time downsides that the commit that you referenced was intended to avoid, one issue is that MLICM's hosting capability are currently more powerful than
our rematerialization capability (as we can hoist multiple instructions but only remateralize single instructions), and that could cause some issues (e.g., the hoisting can increase register pressure that the regalloc framework can't undo).</p>
<p> -Hal<br>
</p>
<blockquote type="cite" cite="mid:MN2PR12MB3840E52E8B0F8A6865E1D480B8F90@MN2PR12MB3840.namprd12.prod.outlook.com">
<div class="WordSection1">
<p class="MsoNormal"><br>
Thanks<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">--<o:p></o:p></p>
<p class="MsoNormal">Danila<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>