[PATCH] D85946: [InstSimplify] Simplify to vector constants when possible

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 10:18:21 PDT 2020


aeubanks added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4620
+  if (Op0Const && Op1Const)
+    return ConstantExpr::getShuffleVector(Op0Const, Op1Const, Mask);
+
----------------
aeubanks wrote:
> efriedma wrote:
> > This is redundant, I think?
> What do you mean? Removing this makes the newly added `insertelement_shufflevector_inline_to_ret()` fail.
Oh you mean similar to `ConstantExpr::getInsertElement()`? The check above also checks for `if (!Scalable)` which is why it doesn't trigger here. Maybe above instead of 
```
  if (!Scalable && Op0Const && Op1Const)
    return ConstantFoldShuffleVectorInstruction(Op0Const, Op1Const, Mask);
```
it should be
```
  if (Op0Const && Op1Const)
    if (auto* Res = ConstantFoldShuffleVectorInstruction(Op0Const, Op1Const, Mask))
      return Res;
```
?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85946



More information about the llvm-commits mailing list