[llvm] [SLP][AMDGPU] Vectorize operands of non-trivially-vectorizable intrinsic calls (PR #189784)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 01:57:00 PDT 2026
================
@@ -243,6 +243,52 @@ static const int MinScheduleRegionSize = 16;
/// Maximum allowed number of operands in the PHI nodes.
static const unsigned MaxPHINumOperands = 128;
+/// For instructions that are not trivially vectorizable, try to vectorize thier
+/// operands.
+static Value *getNonTriviallyVectorizableIntrinsicCallOperand(Value *V) {
+ auto *I = dyn_cast<Instruction>(V);
+ if (!I)
+ return nullptr;
+
+ Value *Operand = nullptr;
+
+ // Early bail out conditions
+ if (auto *CI = dyn_cast<CallInst>(I)) {
+ Intrinsic::ID ID = CI->getIntrinsicID();
+
+ // Only consider intrinsic calls.
+ // FIXME: We may want to relax this condition in future.
+ if (ID == Intrinsic::not_intrinsic)
+ return nullptr;
+
+ // Skip trivially vectorizable intrinsics.
+ if (isTriviallyVectorizable(ID))
+ return nullptr;
+
+ // Only look through unary intrinsic calls.
+ if (CI->arg_size() != 1)
+ return nullptr;
+
+ // Check if it is speculatable, no memory access and will return
+ if (!CI->hasFnAttr(Attribute::Speculatable) || !CI->doesNotAccessMemory() ||
+ !CI->willReturn())
+ return nullptr;
+
+ Operand = CI->getArgOperand(0);
+
+ // Operand type should match the result type we ignore type changing
+ // intrinsics.
+ if (Operand->getType() != CI->getType())
+ return nullptr;
+ }
+
+ // Only consider the operand if it is an Instruction.
+ if (!Operand || !isa<Instruction>(Operand))
+ return nullptr;
----------------
arsenm wrote:
Make Operand be Instruction to start
https://github.com/llvm/llvm-project/pull/189784
More information about the llvm-commits
mailing list