[PATCH] D63431: AMDGPU: Fold readlane/readfirstlane calls
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 08:10:48 PDT 2019
nhaehnle added a comment.
Good idea, but needs a fix I think.
================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:3787-3798
+ if (match(II->getArgOperand(0), m_Intrinsic<Intrinsic::amdgcn_readfirstlane>()))
+ return replaceInstUsesWith(*II, II->getArgOperand(0));
+
+ if (IID == Intrinsic::amdgcn_readfirstlane) {
+ // readfirstlane (readlane x, y) -> readlane x, y
+ if (match(II->getArgOperand(0), m_Intrinsic<Intrinsic::amdgcn_readlane>()))
+ return replaceInstUsesWith(*II, II->getArgOperand(0));
----------------
I believe all of these need to be guarded by being in the same basic block, since the user could be observing a read(first)lane inside a divergent loop.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63431/new/
https://reviews.llvm.org/D63431
More information about the llvm-commits
mailing list