[PATCH] D50778: [LV] Vectorize loops where non-phi instructions used outside loop

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 15 11:19:31 PDT 2018


anna added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorizationLegality.cpp:438
   // Reductions, Inductions and non-header phis are allowed to have exit users. All
   // other instructions must not have external users.
   if (!AllowedExit.count(Inst))
----------------
hiraditya wrote:
> This would be trivial if we realize that outside user must be in a loop-closed phi node for a valid LCSSA, IIUC @sebpop ?
We will still need to check if the phi node use is contained in the loop or not. So, at best, it will reduce the number of cases where we will need to do the `contains` operation.
```
if (isa<PHINode>(UI) && !TheLoop->contains(UI)) {
   LLVM_DEBUG(dbgs() << "LV: Found an outside user for : " << *UI << '\n');
   return true;
}
```
Feel free to update this if you'd like, outside of this patch. 



Repository:
  rL LLVM

https://reviews.llvm.org/D50778





More information about the llvm-commits mailing list