On Windows ARM64, intrinsic __debugbreak is compiled into brk #0xF000 which is mapped to llvm.debugtrap in Clang. Instruction brk #F000 is the defined break point instruction on ARM64 which is recognized by Windows debugger and exception handling code, so llvm.debugtrap should map to it instead of redirecting to llvm.trap (brk #1) as the default implementation.
I think fastisel will simply fall back to SDAG, which is fine, but llc -global-isel on this test case aborts, so I think you need to handle this next to Intrinsic::trap in AArch64InstructionSelector::selectIntrinsicWithSideEffects as well. I could be wrong, though, I haven't worked with globalisel. I believe it's the default strategy for O0 AArch64 codegen these days, so it would be good to be able to select this intrinsic. Otherwise, looks good, thanks for handling this in LLVM.
|1 ↗||(On Diff #205934)|
Can you add RUN lines to test this with fast and global isel? Just re-run with -fast-isel and -global-isel using the same CHECKs.
I believe it's the default strategy for O0 AArch64 codegen these days
The configuration we use for that has -global-isel-abort=0, so it will also fall back to SelectionDAG isel. So it shouldn't be necessary to implement it, although it might be nice as a followup.