summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorMarek Olsak <marek.olsak@amd.com>2017-10-24 10:27:13 +0000
committerMarek Olsak <marek.olsak@amd.com>2017-10-24 10:27:13 +0000
commitce76ea03942d5190da13376c8c9f32d6cc671ed8 (patch)
treed7e8d096604a8aeec814b3f9700b8900e4951fba /llvm/lib/Transforms
parent2114fc3bcba7f84f1a1d9e7704b5eac9657814a4 (diff)
downloadbcm5719-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')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp8
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.
OpenPOWER on IntegriCloud