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

Dinar Temirbulatov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 06:01:16 PDT 2018


dtemirbulatov added inline comments.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1526
 
+static Value *getDefaultConstantForOpcode(unsigned Opcode, Type *Ty) {
+  switch(Opcode) {
----------------
lebedev.ri wrote:
> 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;
> ```
oh, yes, sorry, it just a different behaviour here. we want for example 1 division and ConstantExpr::getBinOpIdentity would return 0. 


https://reviews.llvm.org/D28907





More information about the llvm-commits mailing list