[PATCH] D69228: [LV] Generalize conditions for sinking instrs for first order recurrences.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 20 16:25:24 PDT 2019


fhahn created this revision.
fhahn added reviewers: hsaito, dcaballe, Ayal, rengolin.
Herald added subscribers: rkruppe, hiraditya.
Herald added a project: LLVM.

If the recurrence PHI node has a single user, we can sink any
instruction without side effects, given that all users are dominated by
the instruction computing the incoming value of the next iteration
('Previous'). We can sink instructions that may cause traps, because
that only causes the trap to occur later, but not on any new paths.

With the relaxed check, we also have to make sure that we do not have a
direct cycle (meaning PHI user == 'Previous), which indicates a
reduction relation, which potentially gets missed by
ReductionDescriptor.

As follow-ups, we can also sink stores, iff they do not alias with
other instructions we move them across and we could also support sinking
chains of instructions and multiple users of the PHI.

Fixes PR43398.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69228

Files:
  llvm/lib/Analysis/IVDescriptors.cpp
  llvm/test/Transforms/LoopVectorize/first-order-recurrence-complex.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69228.225808.patch
Type: text/x-patch
Size: 12008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191020/d859dbe5/attachment-0001.bin>


More information about the llvm-commits mailing list