[llvm] [AMDGPU] Improve uniform argument handling in InstCombineIntrinsic (PR #105812)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 05:11:12 PDT 2024
================
@@ -440,6 +440,22 @@ static bool canContractSqrtToRsq(const FPMathOperator *SqrtOp) {
SqrtOp->getType()->isHalfTy();
}
+/// Return true if we can easily prove that use U is uniform.
+static bool isTriviallyUniform(const Use &U) {
+ Value *V = U.get();
+ if (isa<Constant>(V))
+ return true;
+ if (auto *I = dyn_cast<Instruction>(V)) {
+ // If I and U are in different blocks then there is a possibility of
+ // temporal divergence.
+ if (I->getParent() != cast<Instruction>(U.getUser())->getParent())
+ return false;
+ if (const auto *II = dyn_cast<IntrinsicInst>(I))
----------------
jayfoad wrote:
Yeah, fair enough. I was trying to leave the door open for extending this code to handle other `Instruction` types, but I don't actually have a use case in mind for that.
https://github.com/llvm/llvm-project/pull/105812
More information about the llvm-commits
mailing list