Amara Emerson f9d69a0ab0 [GlobalISel] Implement support for the "trap-func-name" attribute.
This attribute calls a function instead of emitting a trap instruction.

Differential Revision: https://reviews.llvm.org/D110098
2021-09-20 14:32:01 -07:00

20 lines
446 B
LLVM

; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
; RUN: llc < %s -mtriple=arm64-eabi -global-isel | FileCheck %s
define void @foo() nounwind {
; CHECK-LABEL: foo
; CHECK: brk #0x1
tail call void @llvm.trap()
ret void
}
declare void @llvm.trap() nounwind
; CHECK-LABEL: {{\_?}}foo_trap_func:
; CHECK: bl trap_func
define void @foo_trap_func() {
call void @llvm.trap() #0
unreachable
}
attributes #0 = { "trap-func-name"="trap_func" }