[PATCH] D62534: [LoopVectorize] Merge UnaryOperator and BinaryOperator handling

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 11:11:30 PDT 2019


fhahn accepted this revision.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM, IMO it makes sense to add this helper here.



================
Comment at: llvm/include/llvm/IR/IRBuilder.h:1386
 
+  Value *CreateNAryOp(unsigned Opc, ArrayRef<Value *> Ops,
+                      const Twine &Name = "",
----------------
Maybe worth a comment that it either creates a binop or unaryop and Opc must be valid accordingly.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3988
+      SmallVector<Value *, 2> Ops;
+      for (unsigned i = 0; i != I.getNumOperands(); ++i) {
+        Value *V = getOrCreateVectorValue(I.getOperand(i), Part);
----------------
nit: Could be just ```
  for (Value *Op : operands())  
     Ops.push_back(getOrCreateVectorValue(Op, Part));
```


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

https://reviews.llvm.org/D62534





More information about the llvm-commits mailing list