[PATCH] D77869: [VPlan] Introduce VPWidenSelectRecipe (NFC).

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 12 16:33:44 PDT 2020


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4420
+
+  auto *ScalarCond = getOrCreateScalarValue(I.getOperand(0), {0, 0});
+
----------------
A separate, independent nit, while we're here: get or create only values that are needed:


```
auto *ScalarCond = (InvariantCond ? getOrCreateScalarValue(I.getOperand(0), {0, 0}) : nullptr);
```


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4423
+  for (unsigned Part = 0; Part < UF; ++Part) {
+    Value *Cond = getOrCreateVectorValue(I.getOperand(0), Part);
+    Value *Op0 = getOrCreateVectorValue(I.getOperand(1), Part);
----------------
`   Value *Cond = (InvariantCond ? ScalarCond : getOrCreateVectorValue(I.getOperand(0), Part));`


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4426
+    Value *Op1 = getOrCreateVectorValue(I.getOperand(2), Part);
+    Value *Sel =
+        Builder.CreateSelect(InvariantCond ? ScalarCond : Cond, Op0, Op1);
----------------
`   Value *Sel = Builder.CreateSelect(Cond, Op0, Op1);`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77869





More information about the llvm-commits mailing list