The instruction selection pass for SPIR-V now performs dead code elimination (DCE). This change removes unused instructions, leading to more optimized SPIR-V output. As a consequence of this, several tests were updated to ensure their continued correctness and to prevent previously tested code from being optimized away. Specifically: - Many tests now store computed values into global variables to ensure they are not eliminated by DCE, allowing their code generation to be verified. - The test `keep-tracked-const.ll` was removed because it no longer tested its original intent. The check statements in this test were for constants generated when expanding a G_TRUNC instruction, which is now removed by DCE instead of being expanded. - A new test, `remove-dead-type-intrinsics.ll`, was added to confirm that dead struct types are correctly removed by the compiler. These updates improve the SPIR-V backends optimization capabilities and maintain the robustness of the test suite. --------- Co-authored-by: Nathan Gauër <github@keenuts.net>
28 lines
1.1 KiB
LLVM
28 lines
1.1 KiB
LLVM
; RUN: not llc -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
|
|
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_KHR_bfloat16 %s -o - | FileCheck %s
|
|
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_bfloat16 %s -o - -filetype=obj | spirv-val %}
|
|
|
|
; CHECK-ERROR: LLVM ERROR: OpTypeFloat type with bfloat requires the following SPIR-V extension: SPV_KHR_bfloat16
|
|
|
|
; CHECK-DAG: OpCapability BFloat16TypeKHR
|
|
; CHECK-DAG: OpExtension "SPV_KHR_bfloat16"
|
|
; CHECK: %[[#BFLOAT:]] = OpTypeFloat 16 0
|
|
; CHECK: %[[#]] = OpTypeVector %[[#BFLOAT]] 2
|
|
|
|
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
|
|
target triple = "spir64-unknown-unknown"
|
|
|
|
@G1 = global bfloat 0.0
|
|
@G2 = global <2 x bfloat> zeroinitializer
|
|
|
|
define spir_kernel void @test() {
|
|
entry:
|
|
%addr1 = alloca bfloat
|
|
%addr2 = alloca <2 x bfloat>
|
|
%data1 = load bfloat, ptr %addr1
|
|
%data2 = load <2 x bfloat>, ptr %addr2
|
|
store bfloat %data1, ptr @G1
|
|
store <2 x bfloat> %data2, ptr @G2
|
|
ret void
|
|
}
|