1// RUN: mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics %s | FileCheck %s
2
3// CHECK:      module {
4// CHECK-NEXT:   spv.module Logical GLSL450 {
5// CHECK-NEXT:     spv.SpecConstant @m1_sc
6// CHECK-NEXT:     spv.SpecConstant @m2_sc
7// CHECK-NEXT:     spv.func @variable_init_spec_constant
8// CHECK-NEXT:       spv.mlir.referenceof @m2_sc
9// CHECK-NEXT:       spv.Variable init
10// CHECK-NEXT:       spv.Return
11// CHECK-NEXT:     }
12// CHECK-NEXT:   }
13// CHECK-NEXT: }
14
15module {
16spv.module Logical GLSL450 {
17  spv.SpecConstant @m1_sc = 42.42 : f32
18}
19
20spv.module Logical GLSL450 {
21  spv.SpecConstant @m2_sc = 42 : i32
22  spv.func @variable_init_spec_constant() -> () "None" {
23    %0 = spv.mlir.referenceof @m2_sc : i32
24    %1 = spv.Variable init(%0) : !spv.ptr<i32, Function>
25    spv.Return
26  }
27}
28}
29
30// -----
31
32module {
33spv.module Physical64 GLSL450 {
34}
35
36// expected-error @+1 {{input modules differ in addressing model and/or memory model}}
37spv.module Logical GLSL450 {
38}
39}
40
41// -----
42
43module {
44spv.module Logical Simple {
45}
46
47// expected-error @+1 {{input modules differ in addressing model and/or memory model}}
48spv.module Logical GLSL450 {
49}
50}
51