[PATCH] D28907: [SLP] Fix for PR30787: Failure to beneficially vectorize 'copyable' elements in integer binary ops.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 05:44:08 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1526
 
+static Value *getDefaultConstantForOpcode(unsigned Opcode, Type *Ty) {
+  switch(Opcode) {
----------------
dtemirbulatov wrote:
> RKSimon wrote:
> > Can we use ConstantExpr::getBinOpIdentity instead?
> no, ConstantExpr::getBinOpIdentity does support only commutative operations.
Are you sure?
```
Constant *ConstantExpr::getBinOpIdentity(unsigned Opcode, Type *Ty,
                                         bool AllowRHSConstant) {
...

  // Non-commutative opcodes: AllowRHSConstant must be set.
  if (!AllowRHSConstant)
    return nullptr;
```


https://reviews.llvm.org/D28907





More information about the llvm-commits mailing list