Skip to content

Commit 3d28e52

Browse files
authored
Ignore llvm.ubsantrap intrinsic (#2161)
It's the similar case as llvm.trap intrinsic - the preferred way is to ignore it in the translator.
1 parent aab0dac commit 3d28e52

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3484,6 +3484,7 @@ bool LLVMToSPIRVBase::isKnownIntrinsic(Intrinsic::ID Id) {
34843484
case Intrinsic::invariant_end:
34853485
case Intrinsic::dbg_label:
34863486
case Intrinsic::trap:
3487+
case Intrinsic::ubsantrap:
34873488
case Intrinsic::arithmetic_fence:
34883489
case Intrinsic::masked_gather:
34893490
case Intrinsic::masked_scatter:
@@ -4212,6 +4213,7 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
42124213
// llvm.trap intrinsic is not implemented. But for now don't crash. This
42134214
// change is pending the trap/abort intrinsic implementation.
42144215
case Intrinsic::trap:
4216+
case Intrinsic::ubsantrap:
42154217
// llvm.instrprof.* intrinsics are not supported
42164218
case Intrinsic::instrprof_increment:
42174219
case Intrinsic::instrprof_increment_step:

test/llvm-intrinsics/ubsantrap.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
; RUN: llvm-as %s -o %t.bc
2+
; RUN: llvm-spirv %t.bc -o %t.spv
3+
; RUN: spirv-val %t.spv
4+
5+
target triple = "spir64-unknown-unknown"
6+
7+
define spir_func void @test_ubsantrap() {
8+
entry:
9+
call void @llvm.ubsantrap(i8 16)
10+
ret void
11+
}
12+
13+
declare void @llvm.ubsantrap(i8)

0 commit comments

Comments
 (0)