[llvm] [SLP]Support copyable GEP/zext main ops and relax gather pointer compatibility (PR #221599)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 13:47:47 PDT 2026


================
@@ -547,11 +547,30 @@ bool InstructionsState::isCopyableElement(Value *V) const {
   assert(valid() && "InstructionsState is invalid.");
   if (!HasCopyables)
     return false;
-  if (isAltShuffle() || getOpcode() == Instruction::GetElementPtr)
+  if (isAltShuffle())
     return false;
   auto *I = dyn_cast<Instruction>(V);
+  // Copyable lanes of a cast node are limited to constants representable as
+  // the cast of a source-type constant.
+  if (isa<CastInst>(MainOp)) {
+    if (I || isa<PoisonValue>(V))
----------------
alexey-bataev wrote:

The generic `!I` path below it also treats poison as not copyable. With the change, the poison lane and the constant lane together reach the `CopyableNum * 2 >= VL.size()` check and exit. The zext node is then no longer formed, and X86/copyable-zext-poison-lane.ll fails.

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


More information about the llvm-commits mailing list