Steven Perron 7486c6987e
[SPIRV] Restrict OpName generation to major values (#171886)
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.
2025-12-18 19:46:59 +00:00

32 lines
1.3 KiB
LLVM

; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
; CHECK-SPIRV-NOT: OpDecorate %{{.*}} FPFastMathMode
; CHECK-SPIRV: %[[#float:]] = OpTypeFloat 32
; CHECK-SPIRV: %[[#r1:]] = OpFNegate %[[#float]]
; CHECK-SPIRV: %[[#r2:]] = OpFNegate %[[#float]]
; CHECK-SPIRV: %[[#r3:]] = OpFNegate %[[#float]]
; CHECK-SPIRV: %[[#r4:]] = OpFNegate %[[#float]]
; CHECK-SPIRV: %[[#r5:]] = OpFNegate %[[#float]]
; CHECK-SPIRV: %[[#r6:]] = OpFNegate %[[#float]]
; CHECK-SPIRV: %[[#r7:]] = OpFNegate %[[#float]]
define spir_kernel void @testFNeg(float %a, float addrspace(1)* %out) local_unnamed_addr {
entry:
%r1 = fneg float %a
store volatile float %r1, float addrspace(1)* %out
%r2 = fneg nnan float %a
store volatile float %r2, float addrspace(1)* %out
%r3 = fneg ninf float %a
store volatile float %r3, float addrspace(1)* %out
%r4 = fneg nsz float %a
store volatile float %r4, float addrspace(1)* %out
%r5 = fneg arcp float %a
store volatile float %r5, float addrspace(1)* %out
%r6 = fneg fast float %a
store volatile float %r6, float addrspace(1)* %out
%r7 = fneg nnan ninf float %a
store volatile float %r7, float addrspace(1)* %out
ret void
}