1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_KHR_linkonce_odr %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV-EXT
2 ; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_KHR_linkonce_odr %s -o - -filetype=obj | spirv-val %}
4 ; CHECK-SPIRV-EXT: Capability Linkage
5 ; CHECK-SPIRV-EXT: Extension "SPV_KHR_linkonce_odr"
6 ; CHECK-SPIRV-EXT-DAG: OpDecorate %[[#]] LinkageAttributes "GV" LinkOnceODR
7 ; CHECK-SPIRV-EXT-DAG: OpDecorate %[[#]] LinkageAttributes "square" LinkOnceODR
9 ; No extension -> no LinkOnceODR
10 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
11 ; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
13 ; CHECK-SPIRV-NOT: OpExtension "SPV_KHR_linkonce_odr"
14 ; CHECK-SPIRV-NOT: OpDecorate %[[#]] LinkageAttributes "GV" LinkOnceODR
15 ; CHECK-SPIRV-NOT: OpDecorate %[[#]] LinkageAttributes "square" LinkOnceODR
17 @GV = linkonce_odr addrspace(1) global [3 x i32] zeroinitializer, align 4
19 define spir_kernel void @k() {
21 %call = call spir_func i32 @square(i32 2)
25 define linkonce_odr dso_local spir_func i32 @square(i32 %in) {
27 %in.addr = alloca i32, align 4
28 store i32 %in, i32* %in.addr, align 4
29 %0 = load i32, i32* %in.addr, align 4
30 %1 = load i32, i32* %in.addr, align 4
31 %mul = mul nsw i32 %0, %1