summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SPIRV/OpVariable_order.ll
blob: a4ca3aa709f0fab77e558048f60701477cbec918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
; REQUIRES: spirv-tools
; RUN: llc -O0 -mtriple=spirv-unknown-linux %s -o - -filetype=obj | not spirv-val 2>&1 | FileCheck %s

; TODO(#66261): The SPIR-V backend should reorder OpVariable instructions so this doesn't fail,
;     but in the meantime it's a good example of the spirv-val tool working as intended.

; CHECK: All OpVariable instructions in a function must be the first instructions in the first block.

define void @main() #1 {
entry:
  %0 = alloca <2 x i32>, align 4
  %1 = getelementptr <2 x i32>, ptr %0, i32 0, i32 0
  %2 = alloca float, align 4
  ret void
}

attributes #1 = { "hlsl.numthreads"="4,8,16" "hlsl.shader"="compute" }