[llvm] [GlobalISel] Introduce G_TRAP, G_DEBUGTRAP, G_UBSANTRAP (PR #84941)

Evgenii Kudriashov via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 09:32:53 PDT 2024


e-kud wrote:

The idea of having these opcodes has been suggested by @arsenm in https://github.com/llvm/llvm-project/pull/83498#discussion_r1508565901

I find it useful as X86, AArch64, RISCV and Mips can avoid manual selection. AMDGPU is an exception as it lowers traps during legalization even using Selection DAG.

I'm not sure whether it is a good idea or not to edit all targets at once. But I'd like to avoid intermediate stage when both `G_*TRAP` and `G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.*trap)` are allowed.

I've tried to cleanup all `G_INTRINSIC_W_SIDE_EFFECTS.*trap` usages as well as  `llvm.*trap`.

Let me know if the change is undesired, then I'll simply merge aforementioned fix for `X86`.

https://github.com/llvm/llvm-project/pull/84941


More information about the llvm-commits mailing list