File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
lib/Dialect/SPIRV/Transforms
test/Dialect/SPIRV/Transforms Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -274,7 +274,12 @@ void LowerABIAttributesPass::runOnOperation() {
274
274
spirv::ModuleOp module = getOperation ();
275
275
MLIRContext *context = &getContext ();
276
276
277
- spirv::TargetEnv targetEnv (spirv::lookupTargetEnv (module ));
277
+ spirv::TargetEnvAttr targetEnvAttr = spirv::lookupTargetEnv (module );
278
+ if (!targetEnvAttr) {
279
+ module ->emitOpError (" missing SPIR-V target env attribute" );
280
+ return signalPassFailure ();
281
+ }
282
+ spirv::TargetEnv targetEnv (targetEnvAttr);
278
283
279
284
SPIRVTypeConverter typeConverter (targetEnv);
280
285
Original file line number Diff line number Diff line change 1
- // RUN: mlir-opt -split-input-file -spirv-lower-abi-attrs %s | FileCheck %s
1
+ // RUN: mlir-opt --split-input-file --spirv-lower-abi-attrs --verify-diagnostics %s \
2
+ // RUN: | FileCheck %s
2
3
3
4
module attributes {
4
5
spirv.target_env = #spirv.target_env <
@@ -31,3 +32,10 @@ spirv.module Logical GLSL450 {
31
32
} // end spirv.module
32
33
33
34
} // end module
35
+
36
+ // -----
37
+
38
+ module {
39
+ // expected-error@+1 {{'spirv.module' op missing SPIR-V target env attribute}}
40
+ spirv.module Logical GLSL450 {}
41
+ } // end module
You can’t perform that action at this time.
0 commit comments