[PATCH] D81415: [LoopVectorizer] Don't create unused block masks for reductions. NFC

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 04:45:09 PDT 2020


dmgreen marked an inline comment as done.
dmgreen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1306
+  bool hasOutOfLoopReductions() const {
+    return !Legal->getReductionVars().empty();
+  }
----------------
SjoerdMeijer wrote:
> Quick question on terminology and "inside" and "outside".
> `getReductionVars()` returns "reduction variables found in the loop". Here you're actually checking if there are inside loop reductions. But having inside reductions means there's a statement/loop after the vectorised loop that sums the partial reductions/sums, correct? If so, it's probably worth clarifying this a bit.  
Ideally this would go with D75069, where inloop vs outside loop reductions are introduced. Until then this might not be the best language on it's own, but I was planning to commit the two close together in any case.

Outside loop reductions are what you would expect from reductions right now:
  loop:
    l = load
    a = add a, l
  vecreduce(a)

Inside loop reductions put the reduction into the loop:
  loop:
    l = load
    a = a + vecreduce(l)

So in the short term, this should probably be called "hasReductions()".  But with D75069 should make more sense.


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

https://reviews.llvm.org/D81415





More information about the llvm-commits mailing list