[PATCH] D77448: [PowerPC] Canonicalize shuffles to match more single-instruction masks on LE

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 23:04:22 PDT 2020


steven.zhang added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:14037
+  // Find first non-undef input.
+  for (int i = 0, e = Op.getNumOperands(); i < e; i++) {
+    FirstOp = Op.getOperand(i);
----------------
nemanjai wrote:
> nemanjai wrote:
> > steven.zhang wrote:
> > > lei wrote:
> > > > Can this and the for-loop below be a range based for-loop?
> > > > ```
> > > > for (auto FirstOp : Op->op_values())
> > > >   if (!FirstOp.isUndef())
> > > >     break;
> > > > ```
> > > Can we use llvm::any_of to make the code more compact ?
> > How? I need to find the first operand that is *not* `undef`.
> But then `FirstOp` is out of scope after the loop and we need it.
Ah, sorry. Maybe, llvm::find_if_not is the right one. But it seems not help too much for this case. So, it depends on you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77448





More information about the llvm-commits mailing list