[PATCH] D28168: [LV] Update dominator tree before fixing external IV users

Matthew Simpson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 14:03:18 PST 2016


mssimpso created this revision.
mssimpso added a reviewer: mkuper.
mssimpso added subscribers: llvm-commits, mcrosier.
Herald added a subscriber: mzolotukhin.

This patch delays the fix-up step for external induction variable users until after the dominator tree has been properly updated. This should fix PR30742. The SCEVExpander in InductionDescriptor::transform can generate code in the wrong location if the dominator tree is not up-to-date.

I'm not quite sure if the is the right approach or not. In particular, we use InductionDescriptor::transform in other locations before the dominator tree has been updated. Maybe this isn't a problem because the vector loop is still detached from the dominator tree? In any case, I made an attempt to keep the dominator tree up-to-date at the outset when creating the structure of the vector loop, but that caused the SCEVExpander to generate worse code (the expander was either crashing or creating a new canonical induction variable for every loop). The use of InductionDescriptor::transform when fixing the external induction variable users may be unique in that the insertion point is outside the loop (it's in the middle block). I'm not sure if this would make a difference, though. Please take a look.

      

Reference: https://llvm.org/bugs/show_bug.cgi?id=30742


https://reviews.llvm.org/D28168

Files:
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/iv_outside_user.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28168.82694.patch
Type: text/x-patch
Size: 3969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161229/19d6a7ae/attachment.bin>


More information about the llvm-commits mailing list