Files
clang-p2996/llvm/test/CodeGen/SPIRV/function/trivial-function-with-call.ll
Ilia Diachkov 153dee34f1 [SPIR-V](6/6) Add the module analysis pass and the simplest tests
This patch adds one SPIRV analysis pass and extends AsmPrinter. It is
essential for minimum SPIR-V output. Also it adds several simplest tests
to show that the target basically works.

Differential Revision: https://reviews.llvm.org/D116465

Authors: Aleksandr Bezzubikov, Lewis Crawford, Ilia Diachkov,
Michal Paszkowski, Andrey Tretyakov, Konrad Trifunovic

Co-authored-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Co-authored-by: Ilia Diachkov <iliya.diyachkov@intel.com>
Co-authored-by: Michal Paszkowski <michal.paszkowski@outlook.com>
Co-authored-by: Andrey Tretyakov <andrey1.tretyakov@intel.com>
Co-authored-by: Konrad Trifunovic <konrad.trifunovic@intel.com>
2022-04-20 01:10:25 +02:00

31 lines
852 B
LLVM

; RUN: llc -O0 %s -o - | FileCheck %s
target triple = "spirv32-unknown-unknown"
; Debug info:
; CHECK: OpName [[FOO:%.+]] "foo"
; CHECK: OpName [[BAR:%.+]] "bar"
; Types:
; CHECK-DAG: [[I32:%.+]] = OpTypeInt 32
; CHECK-DAG: [[VOID:%.+]] = OpTypeVoid
; CHECK-DAG: [[FNVOID:%.+]] = OpTypeFunction [[VOID]] [[I32]]
; CHECK-DAG: [[FNI32:%.+]] = OpTypeFunction [[I32]] [[I32]]
; Function decl:
; CHECK: [[BAR]] = OpFunction [[I32]] None [[FNI32]]
; CHECK-NEXT: OpFunctionParameter [[I32]]
; CHECK-NEXT: OpFunctionEnd
declare i32 @bar(i32 %x)
; Function def:
; CHECK: [[FOO]] = OpFunction [[VOID]] None [[FNVOID]]
; CHECK: OpFunctionParameter
; CHECK: OpLabel
; CHECK: OpFunctionCall [[I32]] [[BAR]]
; CHECK: OpReturn
; CHECK-NOT: OpLabel
; CHECK: OpFunctionEnd
define spir_func void @foo(i32 %x) {
%call1 = call spir_func i32 @bar(i32 %x)
ret void
}