[llvm-dev] Calling LowerSwitchPass causing crash in llvm 9

n3v3rm03 via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 26 01:49:25 PST 2019


Sorry I found an early thread discussing this question. I guess I shouldn't
create lower switch pass like this.
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?
It seems only AMDGPU is using this pass. Is there any rule to call this
pass or not?

On Thu, Dec 26, 2019 at 6:36 PM n3v3rm03 <n3v3rm03 at gmail.com> wrote:

> Hi,
>
> I am trying to call LowerSwitchPass directly in my custom pass in this way:
>
>
>   FunctionPass *lower = createLowerSwitchPass();
>   lower->runOnFunction(*f);
>
> But it will crash when running lower->runOnFunction(*f) in llvm-9.
> 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:
>
> LazyValueInfo *LVI = &getAnalysis<LazyValueInfoWrapperPass>().getLVI();
> //crashed here
>
> I can't figure out why this usage cause the compiler to crash? Am I
> calling function pass wrong?
>
> Thank you for your help.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191226/42ab74ae/attachment.html>


More information about the llvm-dev mailing list