Refines OpName emission to only target Global Variables, Functions, Function Parameters, Local Variables (allocas/phis), and Basic Blocks. This reduces binary size and clutter by avoiding OpName for every intermediate instruction (arithmetic, casts, etc.), while preserving readability for interfaces and program structure. Also updates the test suite to align with this change: - Removes OpName checks for intermediate instructions. - Adds side-effects (e.g., volatile stores) to tests where instructions were previously kept alive solely by their OpName usage. - Updates checks to use generic ID matching where specific names are no longer available. - Adds debug-info/opname-filtering.ll to verify the new policy.
56 lines
2.4 KiB
LLVM
56 lines
2.4 KiB
LLVM
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOEXT
|
|
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
|
|
|
|
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s --spirv-ext=+SPV_ALTERA_arbitrary_precision_integers -o - | FileCheck %s --check-prefixes=CHECK,CHECK-EXT
|
|
|
|
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOEXT
|
|
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
|
|
|
|
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_ALTERA_arbitrary_precision_integers -o - | FileCheck %s --check-prefixes=CHECK,CHECK-EXT
|
|
|
|
; TODO: This test currently fails with LLVM_ENABLE_EXPENSIVE_CHECKS enabled
|
|
; XFAIL: expensive_checks
|
|
|
|
; CHECK-DAG: OpName %[[#Struct:]] "struct"
|
|
; CHECK-DAG: %[[#Struct]] = OpTypeStruct %[[#]] %[[#]] %[[#]]
|
|
; CHECK-DAG: %[[#PtrStruct:]] = OpTypePointer CrossWorkgroup %[[#Struct]]
|
|
; CHECK-EXT-DAG: %[[#Int40:]] = OpTypeInt 40 0
|
|
; CHECK-EXT-DAG: %[[#Int50:]] = OpTypeInt 50 0
|
|
; CHECK-NOEXT-DAG: %[[#Int40:]] = OpTypeInt 64 0
|
|
; CHECK-DAG: %[[#PtrInt40:]] = OpTypePointer CrossWorkgroup %[[#Int40]]
|
|
|
|
; CHECK: OpFunction
|
|
; CHECK: %[[#Arg:]] = OpFunctionParameter
|
|
; CHECK-EXT: %[[#Tr:]] = OpUConvert %[[#Int40]] %[[#R:]]
|
|
; CHECK-EXT: %[[#Store:]] = OpInBoundsPtrAccessChain %[[#PtrStruct]] %[[#Arg]] %[[#]]
|
|
; CHECK-EXT: %[[#StoreAsInt40:]] = OpBitcast %[[#PtrInt40]] %[[#Store]]
|
|
; CHECK-EXT: OpStore %[[#StoreAsInt40]] %[[#Tr]]
|
|
|
|
; CHECK-NOEXT: %[[#Store:]] = OpInBoundsPtrAccessChain %[[#PtrStruct]] %[[#Arg]] %[[#]]
|
|
; CHECK-NOEXT: %[[#StoreAsInt40:]] = OpBitcast %[[#PtrInt40]] %[[#Store]]
|
|
; CHECK-NOEXT: OpStore %[[#StoreAsInt40]] %[[#R:]]
|
|
|
|
; CHECK: OpFunction
|
|
|
|
; CHECK: %[[#QArg:]] = OpFunctionParameter
|
|
; CHECK: %[[#Q:]] = OpFunctionParameter
|
|
; CHECK-EXT: %[[#Tq:]] = OpUConvert %[[#Int40]] %[[#Q]]
|
|
; CHECK-EXT: OpStore %[[#QArg]] %[[#Tq]]
|
|
|
|
; CHECK-NOEXT: OpStore %[[#QArg]] %[[#Q]]
|
|
|
|
%struct = type <{ i32, i8, [3 x i8] }>
|
|
|
|
define spir_kernel void @foo(ptr addrspace(1) %arg, i64 %r) {
|
|
%tr = trunc i64 %r to i40
|
|
%addr = getelementptr inbounds %struct, ptr addrspace(1) %arg, i64 0
|
|
store i40 %tr, ptr addrspace(1) %addr
|
|
ret void
|
|
}
|
|
|
|
define spir_kernel void @bar(ptr addrspace(1) %qarg, i50 %q) {
|
|
%tq = trunc i50 %q to i40
|
|
store i40 %tq, ptr addrspace(1) %qarg
|
|
ret void
|
|
}
|