[llvm] [SLP][NFC]Extract values state/operands analysis into separate class (PR #138724)

Han-Kuan Chen via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 19:46:53 PDT 2025


================
@@ -2896,11 +2885,17 @@ class BoUpSLP {
         // Since operand reordering is performed on groups of commutative
         // operations or alternating sequences (e.g., +, -), we can safely tell
         // the inverse operations by checking commutativity.
-        auto [SelectedOp, Ops] = convertTo(cast<Instruction>(VL[Lane]), S);
+        auto *I = dyn_cast<Instruction>(VL[Lane]);
+        if (!I && isa<PoisonValue>(VL[Lane])) {
----------------
HanKuanChen wrote:

Can we keep
```
        assert((isa<Instruction>(V) || isa<PoisonValue>(V)) &&
               "Expected instruction or poison value");
```
and use `if (isa<PoisonValue>(VL[Lane])) {` here? Also `auto [SelectedOp, Ops] = convertTo(cast<Instruction>(VL[Lane]), S);`.

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


More information about the llvm-commits mailing list