diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-06-14 14:51:26 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-06-14 14:51:26 +0000 |
commit | 492d71cc99d613b2ebd3fb9776f57a54e5c5682a (patch) | |
tree | 7092ddb203649c93e5795ae096b61f127b7bf92e /llvm/lib | |
parent | 0feebef501fc9988493203dee0d86bb7792e587f (diff) | |
download | bcm5719-llvm-492d71cc99d613b2ebd3fb9776f57a54e5c5682a.tar.gz bcm5719-llvm-492d71cc99d613b2ebd3fb9776f57a54e5c5682a.zip |
AMDGPU: Fold readlane intrinsics of constants
I'm not 100% sure about this, since I'm worried about IR transforms
that might end up introducing divergence downstream once replaced with
a constant, but I haven't come up with an example yet.
llvm-svn: 363406
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index f167762b602..347aeb6989a 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -3776,6 +3776,13 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { II->setOperand(0, UndefValue::get(Old->getType())); return II; } + case Intrinsic::amdgcn_readfirstlane: + case Intrinsic::amdgcn_readlane: { + // A constant value is trivially uniform. + if (Constant *C = dyn_cast<Constant>(II->getArgOperand(0))) + return replaceInstUsesWith(*II, C); + break; + } case Intrinsic::stackrestore: { // If the save is right next to the restore, remove the restore. This can // happen when variable allocas are DCE'd. |