<div>Hi:</div><div>As the message suggests, you'll need a PM for it.</div><div>Something like the following would do:</div><div><br></div><div>```</div><div>legacy::FunctionPassManager FPM(&M);;</div><div>FPM.add(createLowerSwitchPass());</div><div>FPM.run(Func)</div><div>```</div><div><br></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> "llvm-dev"<llvm-dev@lists.llvm.org>;</div><div><b>Date: </b> Sat, Nov 13, 2021 02:54 AM</div><div><b>To: </b> "llvm-dev"<llvm-dev@lists.llvm.org>; <wbr></div><div></div><div><b>Subject: </b> [llvm-dev] how to add createLowerSwitchPass to PassManager object?</div></div><div> </div><div style="position:relative;"><div id="tmpcontent_res"></div><div dir="ltr">My pass crashes on the callsite of runOnFunction() as it calls GetAnalysis to LazyValue internally.<br><br>FunctionPass* lower = createLowerSwitchPass();<br>lower->runOnFunction(F);<br><br>The crash log says: <i>Assertion failed: (Resolver && "Pass has not been inserted into a PassManager object!")</i><div><i><br></i></div><div>How do I get the PassManager object to add LowerSwitchPass? I can't happen to find the object anywhere. Can the legacy pass manager run lower passes in llvm14? Alternatively, is there another method I can use to create LowerSwitchPass with the new PassManager?</div></div>

</div></div><!--<![endif]--></includetail></div>