1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll
Michael Liao 78a5d52036 [codegen,amdgpu] Enhance MIR DIE and re-arrange it for AMDGPU.
Summary:
- `dead-mi-elimination` assumes MIR in the SSA form and cannot be
  arranged after phi elimination or DeSSA. It's enhanced to handle the
  dead register definition by skipping use check on it. Once a register
  def is `dead`, all its uses, if any, should be `undef`.
- Re-arrange the DIE in RA phase for AMDGPU by placing it directly after
  `detect-dead-lanes`.
- Many relevant tests are refined due to different register assignment.

Reviewers: rampitec, qcolombet, sunfish

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D72709
2020-01-14 19:26:15 -05:00

29 lines
780 B
LLVM

; RUN: llc -march=amdgcn -verify-machineinstrs %s -o - | FileCheck %s
; CHECK-LABEL: foo
; CHECK-NOT: BUFFER_LOAD_DWORDX2_OFFSET
; After dead code elimination, that buffer load should be eliminated finally
; after dead lane detection.
define amdgpu_kernel void @foo() {
entry:
switch i8 undef, label %foo.exit [
i8 4, label %sw.bb4
i8 10, label %sw.bb10
]
sw.bb4:
%x = load i64, i64 addrspace(1)* undef, align 8
%c = sitofp i64 %x to float
%v = insertelement <2 x float> <float undef, float 0.000000e+00>, float %c, i32 0
br label %foo.exit
sw.bb10:
unreachable
foo.exit:
%agg = phi <2 x float> [ %v, %sw.bb4 ], [ zeroinitializer, %entry ]
%s = extractelement <2 x float> %agg, i32 1
store float %s, float addrspace(1)* undef, align 4
ret void
}