<div dir="ltr">Hi Chandler,<div><br><div>I am now working on a bisecting tool to find mis-optimization on LLVM. I found OptBisect a very useful option and hope to make it work on the new pass manager. I have several questions about it.<br></div><div><br></div><div>1. Any plans to apply codegen stage with new pass manager?</div><div>    IIUC, new pass manager only works for opt stage. However<span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> the OptBisect option tries to accumulate pass counts through opt stage and codegen stage.</span></div><div><span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">    Porting it to new pass manager means that, for now opt stage accumulation will use new pass manager and llc stage will still use legacy pass mechanism.</span></div><div><span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">    May I ask if there is any plan to apply new pass manager for llc stage? If so, the OptBisect porting will also need to expend to codegen stage in the future.</span></div><div><br></div><div>2.  Do we want optnone support for new pass manager?</div><div>    I see OptBisect for each pass was first introduced by modifying optnone check. However new pass manager does not support it IIUC.</div><div>    We can either follow the legacy structure of skipFunction()/Module(), put skippability check in each single pass for new pass manager.</div><div>    Or since there is no optnone support, we now may also create label on each pass to determine it is skippable or not, and then do the check at pass manager level.</div><div><br></div><div>3. No region/basicblock/callgraphscc pass support for new pass manager?</div><div>    In legacy pass manager, OptBisect will be checked by skip() function on certain types of passes. like skipRegion(), skipBasicBlocks().</div><div>    But I did not see implementations of the passes I mentioned above in new passes. So any plan to have them any more?</div><div><br></div><div>4. I<span style="color:rgba(0,0,0,0.87);font-family:"Roboto Slab","Times New Roman",serif;font-size:14px;font-style:normal;font-variant-ligatures:none;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(250,250,250);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">s PassInfoMixin the right place to put skipPass() function?</span></div><div><span style="color:rgba(0,0,0,0.87);font-family:"Roboto Slab","Times New Roman",serif;font-size:14px;font-style:normal;font-variant-ligatures:none;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(250,250,250);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">    The OptBisect works like this: At the beginning of each pass runs, it will call a skipFunction()/Module()/... function under pass.h to check if -opt-bisect is set and how much is counter accumulating.</span></div><div><span style="color:rgba(0,0,0,0.87);font-family:"Roboto Slab","Times New Roman",serif;font-size:14px;font-style:normal;font-variant-ligatures:none;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(250,250,250);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">    Seems all passes come from the structure PassInfoMixin API, and I see name() function in it which is useful of OptBisect.</span></div><div><span style="color:rgba(0,0,0,0.87);font-family:"Roboto Slab","Times New Roman",serif;font-size:14px;font-style:normal;font-variant-ligatures:none;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(250,250,250);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">    Do you think it is the right place to put the skipPass() function, similar to where skipFunction()/Module() located in legacy pass manager?</span></div><div>    </div><div>I currently have a draft on OptBisect porting implementation, and I am willing to have people review it if you like.</div><div><br></div><div>Thanks for taking your time on those questions.</div><div><br></div><div>If anyone is also make similar effort on it, or have any suggestions of implementation, p<span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">lease let me know</span> and I really appreciate :)</div></div><div><br></div><div>Best,</div><div>Zhizhou</div></div>