Skip to content

Commit b1114a9

Browse files
authored
Add llvm.stack[save/restore] intrinsics to isKnownIntrinsic (#3291)
Otherwise their declarations would survive translation to SPIR-V. Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent 1a7c992 commit b1114a9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3998,6 +3998,8 @@ bool LLVMToSPIRVBase::isKnownIntrinsic(Intrinsic::ID Id) {
39983998
case Intrinsic::masked_scatter:
39993999
case Intrinsic::modf:
40004000
case Intrinsic::fake_use:
4001+
case Intrinsic::stacksave:
4002+
case Intrinsic::stackrestore:
40014003
return true;
40024004
default:
40034005
// Unknown intrinsics' declarations should always be translated

test/extensions/INTEL/SPV_INTEL_variable_length_array/basic.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
; CHECK-SPIRV: VariableLengthArrayINTEL [[#IntPtr]] [[#]] [[#A]]
3737
; CHECK-SPIRV: RestoreMemoryINTEL [[#SavedMem]]
3838

39+
; CHECK-SPIRV-NOT: Name [[#]] "llvm.stacksave."
40+
; CHECK-SPIRV-NOT: Name [[#]] "llvm.stackrestore."
41+
3942
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"
4043
target triple = "spir"
4144

0 commit comments

Comments
 (0)