[PATCH] D83288: [LV] Pick vector loop body as insert point for SCEV expansion.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 03:08:23 PDT 2020


fhahn created this revision.
fhahn added reviewers: Ayal, gilr, mkazantsev.
Herald added subscribers: javed.absar, hiraditya.
Herald added a project: LLVM.

Currently the DomTree is not kept up to date for additional blocks
generated in the vector loop, for example when vectorizing with
predication. SCEVExpander relies on dominance checks when looking for
existing instructions to re-use and in some cases that can lead to the
expander picking instructions that do not actually dominate their insert
point (e.g. as in PR46525).

Unfortunately keeping the DT up-to-date is a bit tricky, because the CFG
is only patched up after generating code for a block. For now, we can
just use the vector loop header, as this ensures the inserted
instructions dominate all uses in the vector loop. There should be no
noticeable impact on the generated code, as other passes should sink
those instructions, if profitable.

Fixes PR46525.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83288

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/pr46525-expander-insertpoint.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83288.275968.patch
Type: text/x-patch
Size: 8194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200707/23ae45cd/attachment.bin>


More information about the llvm-commits mailing list