[llvm] [SLP][AMDGPU] Vectorize operands of non-trivially-vectorizable intrinsic calls (PR #189784)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 21:07:19 PDT 2026


================
@@ -29477,6 +29507,28 @@ bool SLPVectorizerPass::vectorizeChainsInBlock(BasicBlock *BB, BoUpSLP &R) {
       PostProcessCmps.insert(cast<CmpInst>(&*It));
   }
 
+  // Collect operands of non-trivially vectorizable intrinsic calls (e.g.,
+  // llvm.amdgcn.exp2) and group by intrinsic ID, so their operands can be
+  // vectorized independently.
+  // FIXME: Extend for all non-vectorized functions.
+  SmallMapVector<std::pair<Intrinsic::ID, unsigned>, SmallVector<Value *, 4>, 4>
+      OpcodeGroups;
+
+  for (Instruction &I : *BB) {
----------------
xgxanq wrote:

> Why in a separate loop?

It is more appropriate to collect within the previous for loop and initiate the operation after completing other traditional processes such as vector tree construction caused by insert/cmp/xxx operations.
Therefore, it can be implemented as a standalone stage, equivalent in status to vectorizeChainsInBlock.

https://github.com/llvm/llvm-project/pull/189784


More information about the llvm-commits mailing list