[llvm] [SLP]Initial support for copyable elements (non-schedulable only) (PR #140279)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 08:47:51 PDT 2025


================
@@ -1220,6 +1235,48 @@ class InstructionsState {
   InstructionsState(Instruction *MainOp, Instruction *AltOp)
       : MainOp(MainOp), AltOp(AltOp) {}
   static InstructionsState invalid() { return {nullptr, nullptr}; }
+
+  bool isCopyableElement(Value *V) const {
+    assert(valid() && "InstructionsState is invalid.");
+    if (isAltShuffle() || getOpcode() == Instruction::GetElementPtr)
+      return false;
+    auto *I = dyn_cast<Instruction>(V);
+    if (!I && isa<PoisonValue>(V))
+      return false;
----------------
RKSimon wrote:

```
if (!I)
  return !isa<PoisonValue>(V);
```
Does this simplify the logic below?

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


More information about the llvm-commits mailing list