File: CommonAddrspaceGlobalVar.ll

package info (click to toggle)
spirv-llvm-translator-21 21.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,612 kB
  • sloc: cpp: 47,807; ansic: 6,283; lisp: 3,878; sh: 162; python: 58; makefile: 41
file content (20 lines) | stat: -rw-r--r-- 592 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
; Ensure that a "common global" is not converted to a locally allocated
; variable when translated to SPIR-V and back to LLVM.

; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; CHECK-LLVM-NOT: alloca
; CHECK-LLVM: @CAG = common addrspace(1) global i32 0, align 4
; CHECK-LLVM-NOT: alloca

target triple = "spir64-unknown-unknown"

@CAG = common addrspace(1) global i32 0, align 4
  
define i32 @f() #0 {
 %1 = load i32, i32 addrspace(1) * @CAG, align 4
 ret i32 %1
}