From 0056868c4a9f362a4dc554a2e82e50554bf11b96 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 13 Jul 2016 06:04:22 +0000 Subject: [PATCH] AMDGPU: Fold out no-op kill intrinsics llvm-svn: 275253 --- llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 8 ++++++++ llvm/test/CodeGen/AMDGPU/skip-if-dead.ll | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 72175ea..7254dac 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -1961,6 +1961,14 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op, return DAG.getMemIntrinsicNode(AMDGPUISD::TBUFFER_STORE_FORMAT, DL, Op->getVTList(), Ops, VT, MMO); } + case AMDGPUIntrinsic::AMDGPU_kill: { + if (const ConstantFPSDNode *K = dyn_cast(Op.getOperand(2))) { + if (!K->isNegative()) + return Chain; + } + + return Op; + } default: return SDValue(); } diff --git a/llvm/test/CodeGen/AMDGPU/skip-if-dead.ll b/llvm/test/CodeGen/AMDGPU/skip-if-dead.ll index 54fc0bf..6c632b4 100644 --- a/llvm/test/CodeGen/AMDGPU/skip-if-dead.ll +++ b/llvm/test/CodeGen/AMDGPU/skip-if-dead.ll @@ -2,7 +2,6 @@ ; CHECK-LABEL: {{^}}test_kill_depth_0_imm_pos: ; CHECK-NEXT: ; BB#0: -; CHECK-NEXT: ; BB#1: ; CHECK-NEXT: s_endpgm define amdgpu_ps void @test_kill_depth_0_imm_pos() #0 { call void @llvm.AMDGPU.kill(float 0.0) -- 2.7.4