xref: /llvm-project/llvm/test/CodeGen/SPIRV/function/trivial-function-definition.ll (revision 67d3ef74b31e1517d4f679e754cc2b3041c95901)
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
2
3;; Debug info:
4; CHECK:     OpName %[[#FOO:]] "foo"
5
6;; Types:
7; CHECK:     %[[#VOID:]] = OpTypeVoid
8; CHECK:     %[[#FN:]] = OpTypeFunction %[[#VOID]]
9
10;; Functions:
11; CHECK:     %[[#FOO]] = OpFunction %[[#VOID]] None %[[#FN]]
12; CHECK-NOT: OpFunctionParameter
13;; NOTE: In 2.4, it isn't explicitly written that a function always has a least
14;;       one block. In fact, 2.4.11 seems to imply that there are at least two
15;;       blocks in functions with a body, but that doesn't make much sense.
16;;       However, in order to distinguish between function declaration and
17;;       definition, a function needs at least one block, hence why this test
18;;       expects one OpLabel + OpReturn.
19; CHECK:     OpLabel
20; CHECK:     OpReturn
21; CHECK-NOT: OpLabel
22; CHECK:     OpFunctionEnd
23define void @foo() {
24  ret void
25}
26