Skip to content

Commit e89da32

Browse files
authored
Signed-off-by: Marcos Maronas <[email protected]>
1 parent 520adcd commit e89da32

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3843,6 +3843,7 @@ bool LLVMToSPIRVBase::isKnownIntrinsic(Intrinsic::ID Id) {
38433843
case Intrinsic::dbg_label:
38443844
case Intrinsic::trap:
38453845
case Intrinsic::ubsantrap:
3846+
case Intrinsic::debugtrap:
38463847
case Intrinsic::uadd_with_overflow:
38473848
case Intrinsic::usub_with_overflow:
38483849
case Intrinsic::arithmetic_fence:
@@ -4719,10 +4720,12 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
47194720
case Intrinsic::invariant_start:
47204721
case Intrinsic::invariant_end:
47214722
case Intrinsic::dbg_label:
4722-
// llvm.trap intrinsic is not implemented. But for now don't crash. This
4723-
// change is pending the trap/abort intrinsic implementation.
4723+
// llvm.trap and llvm.debugtrap intrinsics are not implemented. But for now
4724+
// don't crash. This change is pending the trap/abort intrinsic
4725+
// implementation.
47244726
case Intrinsic::trap:
47254727
case Intrinsic::ubsantrap:
4728+
case Intrinsic::debugtrap:
47264729
// llvm.instrprof.* intrinsics are not supported
47274730
case Intrinsic::instrprof_increment:
47284731
case Intrinsic::instrprof_increment_step:
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
; RUN: llvm-as %s -o %t.bc
2+
; RUN: llvm-spirv %t.bc -spirv-text -o %t
3+
; RUN: FileCheck < %t %s
4+
; RUN: llvm-spirv %t.bc -o %t.spv
5+
; RUN: spirv-val %t.spv
6+
target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
7+
target triple = "spir-unknown-unknown"
8+
9+
; Function Attrs: nounwind
10+
; CHECK: Capability Addresses
11+
; CHECK: "foo"
12+
13+
; Function Attrs: cold noreturn nounwind
14+
declare void @llvm.debugtrap() #8
15+
16+
define spir_kernel void @foo(ptr addrspace(1) %a) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
17+
entry:
18+
%a.addr = alloca ptr addrspace(1), align 4
19+
store ptr addrspace(1) %a, ptr %a.addr, align 4
20+
call void @llvm.debugtrap() #12
21+
ret void
22+
}
23+
24+
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
25+
attributes #12 = { noreturn nounwind }
26+
27+
!opencl.enable.FP_CONTRACT = !{}
28+
!opencl.spir.version = !{!6}
29+
!opencl.ocl.version = !{!6}
30+
!opencl.used.extensions = !{!7}
31+
!opencl.used.optional.core.features = !{!7}
32+
!opencl.compiler.options = !{!7}
33+
34+
!1 = !{i32 1}
35+
!2 = !{!"none"}
36+
!3 = !{!"int*"}
37+
!4 = !{!"int*"}
38+
!5 = !{!""}
39+
!6 = !{i32 1, i32 2}
40+
!7 = !{}

0 commit comments

Comments
 (0)