diff options
author | Marek Olsak <marek.olsak@amd.com> | 2017-10-24 10:27:13 +0000 |
---|---|---|
committer | Marek Olsak <marek.olsak@amd.com> | 2017-10-24 10:27:13 +0000 |
commit | ce76ea03942d5190da13376c8c9f32d6cc671ed8 (patch) | |
tree | d7e8d096604a8aeec814b3f9700b8900e4951fba /llvm/lib/Transforms/InstCombine | |
parent | 2114fc3bcba7f84f1a1d9e7704b5eac9657814a4 (diff) | |
download | bcm5719-llvm-ce76ea03942d5190da13376c8c9f32d6cc671ed8.tar.gz bcm5719-llvm-ce76ea03942d5190da13376c8c9f32d6cc671ed8.zip |
AMDGPU: Add new intrinsic llvm.amdgcn.kill(i1)
Summary:
Kill the thread if operand 0 == false.
llvm.amdgcn.wqm.vote can be applied to the operand.
Also allow kill in all shader stages.
Reviewers: arsenm, nhaehnle
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D38544
llvm-svn: 316427
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index b2282cfd419..3a5debc3223 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -3539,6 +3539,14 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { return replaceInstUsesWith(*II, II->getArgOperand(0)); } + case Intrinsic::amdgcn_kill: { + const ConstantInt *C = dyn_cast<ConstantInt>(II->getArgOperand(0)); + if (!C || !C->getZExtValue()) + break; + + // amdgcn.kill(i1 1) is a no-op + return eraseInstFromFunction(CI); + } case Intrinsic::stackrestore: { // If the save is right next to the restore, remove the restore. This can // happen when variable allocas are DCE'd. |