[PATCH] D135876: [InstCombine] Remove redundant splats in InstCombineVectorOps

Peter Waller via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 03:54:20 PDT 2022


peterwaller-arm added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:2605
+Instruction *InstCombinerImpl::simplifyBinOpSplats(ShuffleVectorInst &SVI) {
+  if (!SVI.isZeroEltSplat())
+    return nullptr;
----------------
I'm seeing instcombine fire on this node:
```
IC: Visiting:   %shuffle = shufflevector <2 x double> %sub, <2 x double> %sub, <2 x i32> <i32 2, i32 2>
```

Where I understand the intent is to only match the first element. The combine then replaces the input with:
```
shufflevector <2 x double> %3, <2 x double> poison, <2 x i32> <i32 2, i32 2>
```

... which is selecting elements from poison.

The reason the combine is firing is that `isZeroEltSplat` will return true if the mask is selecting the zeroth lane of any input operand.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135876/new/

https://reviews.llvm.org/D135876



More information about the llvm-commits mailing list