<div>Hi Arthur:</div><div>Thanks for the hint about RNG. While we are at it, one more thing the documentation is a bit vague about is that:</div><div>Can I insert GVs into the Module in doFinalization()? I know you could do so in doInit(). The reason I'm asking this is that so I could implement my passes as FunctionPass if this holds.</div><div><br></div><div>And again, where does this sort of behavior fits into the new PM? I assume it's also not considered?</div><div><br></div><div>Zhang</div><div><includetail><div> </div><div> </div><div style="font:Verdana normal 14px;color:#000;"><div style="FONT-SIZE: 12px;FONT-FAMILY: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div style="FONT-SIZE: 12px;background:#efefef;padding:8px;"><div id="menu_sender"><b>From: </b> "Arthur Eubanks"<aeubanks@google.com>;</div><div><b>Date: </b> Wed, Nov 10, 2021 02:10 AM</div><div><b>To: </b> "Zhang"<admin@mayuyu.io>; <wbr></div><div><b>Cc: </b> "llvm-dev"<llvm-dev@lists.llvm.org>; <wbr></div><div><b>Subject: </b> Re: [llvm-dev] Where does doInitialization() fit into the new PassManager model?</div></div><div> </div><div style="position:relative;"><div id="tmpcontent_res"></div><div dir="ltr">Yeah there's currently no equivalent of doInitialization() in the new pass manager. Creating a per-module RNG to work on functions seems a bit weird to me. Module::createRNG() attempts to be consistent based on the module name + a per-call site salt, but that makes so changes in one function affect functions visited after. It would make more sense to me to use a per-function RNG salted with the module name and function name. Or if you really want a per-module RNG you could just lazily initialize it in the run(Function &). (Also Module::createRNG() isn't used in tree AFAICT)</div><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 8, 2021 at 7:59 PM Zhang via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<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><font>Hi:</font></div><div>In my legacy pass, I usually use doInitialization() to call Module::createRNG() to create a RandomNumberGenerator, which my FunctionPass later uses.</div><div>How does this model fit into the new PassManager interface? Creating my new pass as run(Function&F ....) and re-create my RNG each time doesn't preserve its internal state, but using run(Module& M) seems a bit overkill to me?</div><div><u></u><u></u></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</div></div><!--<![endif]--></includetail></div>