<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">There is no “switch” instruction in the target object code. It usually gets compiled into a switch table with instructions to load from it. Afaik<br><br><div id="AppleMailSignature" dir="ltr">Zhang</div><div dir="ltr"><br>在 2019年12月26日,17:49,n3v3rm03 via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> 写道:<br><br></div><blockquote type="cite"><div dir="ltr"><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>
</div></blockquote><blockquote type="cite"><div dir="ltr"><span>_______________________________________________</span><br><span>LLVM Developers mailing list</span><br><span><a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a></span><br><span><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></span><br></div></blockquote></body></html>