[PATCH] D51524: [ARM64] [Windows] Handle funclets
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 6 10:12:48 PST 2018
rnk added a comment.
In https://reviews.llvm.org/D51524#1288018, @efriedma wrote:
> > It works for x64 and x86, so I guess it's arm-specific. The state table emission code is portable, so maybe the bug is in the arm ip2state mapping logic?
>
> Looked a bit more; it looks like the problem is actually that the "throw" is the last instruction in the function, so unwinding gets confused. There's some code in X86TargetMachine::X86TargetMachine which turns on TrapUnreachable, which avoids the problem. It looks like MSVC does something similar (it inserts a nop instead of a trap, but same idea). I'll post a patch separately.
We came up with a different solution for this called `SEH_Epilogue`. It basically inserts a nop if the last real instruction was a call. It's slightly complicated because it looks backwards across empty basic blocks and things. You can see it here:
https://github.com/llvm-mirror/llvm/blob/master/lib/Target/X86/X86MCInstLower.cpp#L1800
I've been meaning to see if we can remove the code that enables TrapUnreachable on Windows.
Repository:
rL LLVM
https://reviews.llvm.org/D51524
More information about the llvm-commits
mailing list