[PATCH] D69563: [LV] Strip wrap flags from vectorized reductions

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 14:39:00 PST 2019


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3891
+  Instruction *LoopExitInstr = RdxDesc.getLoopExitInstr();
+  assert(LoopExitInstr != nullptr && "null loop exit instruction");
+  SmallVector<Instruction *, 8> Worklist;
----------------
dantrushin wrote:
> Ayal wrote:
> > There's no need to deal with LoopExitInstr in this implementation; it's probably clearer to start from the Phi as in the original version.
> I'm passing `RecurrenceDescriptor` to this function
> (so I can easily check reduction type here).
> I only can get loop exit instruction from it, not Phi. 
> Here I need *any* reduction instruction to start with, and I don't see much difference between `Phi` and `LoopExitInstr`. 
> 
> Do you want me to pass in Phi instead and check reduction type at call site? 
OK, right. Can pass both RdxDesc and Phi, but using LoopExitInstr is also fine.

It is tempting though to then try and save redundant Loop->contains() calls, perhaps by restricting them only to users of LoopExitInstr, as in:

```
if ((Cur != LoopExitInstr || OrigLoop->contains(UI->getParent())) && Visited.insert(UI).second)
```
?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69563





More information about the llvm-commits mailing list