<div dir="ltr">Sorry I found an early thread discussing this question. I guess I shouldn't create lower switch pass like this.<div>However, I have another question, even if I don't  call this pass, the switch instructions will be finally compiled into binary trees, is that correct?</div><div>It seems only AMDGPU is using this pass. Is there any rule to call this pass or not?</div>





</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 26, 2019 at 6:36 PM n3v3rm03 <<a href="mailto:n3v3rm03@gmail.com">n3v3rm03@gmail.com</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 dir="ltr">Hi,<div><br></div><div>I am trying to call LowerSwitchPass directly in my custom pass in this way:</div><div><br></div><div><br></div>  FunctionPass *lower = createLowerSwitchPass();<br>  lower->runOnFunction(*f);<div><br></div><div>But it will crash when running lower->runOnFunction(*f) in llvm-9. <br>I was using this method in llvm-8 and it worked fine. It seems the crash happens at the first line of the LowerSwitch::runOnFunction(Function &F) in the newer llvm:</div><div><br></div>





LazyValueInfo *LVI = &getAnalysis<LazyValueInfoWrapperPass>().getLVI();  //crashed here<div><br></div><div>I can't figure out why this usage cause the compiler to crash? Am I calling function pass wrong?</div><div><br></div><div>Thank you for your help.</div></div>
</blockquote></div>