<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
> <span style="color: rgb(50, 49, 48); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; background-color: rgb(255, 255, 255); display: inline !important">I would love
 to see Opt and CodeGen using the same pass manager (as my downstream project has already switched to NewPM in Opt).</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(50, 49, 48); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
FWIW I too would love to see CodeGen use the new PM. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Some months ago I worked on a patch, albeit mostly useful downstream, having BasicAA depend on LazyValueInfo but had to ultimately give up on it. With the old PM used in CodeGen I had lots of problems getting the dependencies right, debugging was difficult
 and nobody could really provide answers on exactly how it was supposed to work.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
So that said even if there are no performance gains there would definitely be other benefits.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
-Markus</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of Fedor Sergeev via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Sent:</b> Wednesday, June 19, 2019 12:38 PM<br>
<b>To:</b> Charles.Zhang@sony.com; llvm-dev@lists.llvm.org<br>
<b>Cc:</b> joshua.magee@sony.com<br>
<b>Subject:</b> Re: [llvm-dev] Using the new pass manager for CodeGen</font>
<div> </div>
</div>
<div style="background-color:#FFFFFF">Hi, Charles,<br>
<br>
<div class="x_moz-cite-prefix">On 6/13/19 11:48 PM, via llvm-dev wrote:<br>
</div>
<blockquote type="cite">
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">
<div>Hi,</div>
<div><br>
</div>
<div>I am looking into potentially porting CodeGen and some of the passes to using the new pass manager. Two questions:</div>
<div><br>
</div>
<div>1. Has anybody made an attempt in this direction already? Maybe I am missing a branch out there that has started on this already. From what I can tell, there is no work in-tree in CodeGen that is aware of the new pass manager besides some assembly utilities
 in BackendUtils.cpp. </div>
</div>
</blockquote>
You are right, there is no activity in-tree in that direction to the best of my knowledge.<br>
And every time I was asking on LLVM devmtg if anybody working on that the answer was - "nay".<br>
<blockquote type="cite">
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">
<div>My initial thoughts in this direction were that there would need to be some new pass manager machinery, for example, things like FunctionToMachineFunctionPassAdaptor that handles what MachineFunctionPass::runOnFunction used to do, along with the associated
 AnalysisManager plumbing to understand units of MIR.<br>
</div>
</div>
</blockquote>
Generally, what you describe is indeed a proper first step towards getting CodeGen on New-PM rails:<br>
 - introduce IRUnits for Machine IR<br>
 - provide generic handling for those new units everywhere in New-PM framework<br>
<br>
The next step would be to start moving at least one backend towards it, and thats where the initiative kinda stalls.<br>
I believe people working on CodeGen just do not find enough incentive to start that work.<br>
<br>
<blockquote type="cite">
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">
<div></div>
<div><br>
</div>
<div>2. Are there any compile time improvements expected from porting CodeGen passes in the first place? As far as I can tell, the llc pass pipeline seems to be fairly well fixed in terms of phase ordering, and all the analyses are thrown out from opt anyway.</div>
</div>
</blockquote>
I would expect real savings just by reusing non-Machine-IR analyses.<br>
As soon as you use the same llvm state/module/etc for both Opt and CodeGen purposes
<br>
(thats what I believe many do, at least our JIT compiler does that). That will allow you<br>
to reuse analysis manager and thus keep every cached analysis there.<br>
<br>
I would love to see Opt and CodeGen using the same pass manager (as my downstream project has already switched to NewPM in Opt).<br>
<br>
Said that, perhaps analyses are not a current performance bottleneck in CodeGen (I bet instruction selection will always trump anything else).<br>
So this is more about overall consistency of operations rather than crazy performance gains.<br>
<br>
regards,<br>
  Fedor.<br>
<br>
<blockquote type="cite">
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">
<div></div>
<div>Thanks,<br>
</div>
<div>Charles<br>
</div>
</div>
<br>
<fieldset class="x_mimeAttachmentHeader"></fieldset>
<pre class="x_moz-quote-pre">_______________________________________________
LLVM Developers mailing list
<a class="x_moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org" style="color: rgb(88, 78, 61);">llvm-dev@lists.llvm.org</a>
<a class="x_moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="color: rgb(88, 78, 61);">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
</div>
</body>
</html>