File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -5400,6 +5400,10 @@ bool LLVMToSPIRVBase::transExtension() {
5400
5400
std::string S;
5401
5401
N.nextOp ().get (S);
5402
5402
assert (!S.empty () && " Invalid extension" );
5403
+ ExtensionID ExtID = SPIRVMap<ExtensionID, std::string>::rmap (S);
5404
+ if (!BM->getErrorLog ().checkError (BM->isAllowedToUseExtension (ExtID),
5405
+ SPIRVEC_RequiresExtension, S))
5406
+ return false ;
5403
5407
BM->getExtension ().insert (S);
5404
5408
}
5405
5409
}
Original file line number Diff line number Diff line change
1
+ ; Check whether the translator reports an error for a module with !spirv.Extension
2
+ ; metadata containing an extension that is disabled by --spirv-ext
3
+
4
+ ; RUN: llvm-as < %s -o %t.bc
5
+ ; RUN: not llvm-spirv --spirv-ext=-SPV_KHR_bit_instructions %t.bc 2>&1 | FileCheck %s
6
+
7
+ ; CHECK: RequiresExtension: Feature requires the following SPIR-V extension:
8
+ ; CHECK-NEXT: SPV_KHR_bit_instructions
9
+
10
+ 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"
11
+ target triple = "spir-unknown-unknown"
12
+
13
+ ; Function Attrs: nounwind
14
+ define spir_kernel void @foo () #0 {
15
+ entry:
16
+ ret void
17
+ }
18
+
19
+ attributes #0 = { nounwind }
20
+
21
+ !spirv.MemoryModel = !{!0 }
22
+ !spirv.Source = !{!1 }
23
+ !spirv.Extension = !{!3 }
24
+ !opencl.spir.version = !{!0 }
25
+ !opencl.ocl.version = !{!0 }
26
+ !opencl.used.extensions = !{!2 }
27
+ !opencl.used.optional.core.features = !{!2 }
28
+
29
+ !0 = !{i32 1 , i32 2 }
30
+ !1 = !{i32 3 , i32 102000 }
31
+ !2 = !{}
32
+ !3 = !{!"SPV_KHR_bit_instructions" }
You can’t perform that action at this time.
0 commit comments