[PATCH] D38097: [IVUsers] Changes to make IVUsers's results robust to instruction and uselist ordering

Daniel Neilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 13:46:07 PDT 2017


dneilson created this revision.

Full discussion of the motivation, and some background, for this patch can be
found on the LLVM dev mailing list:

http://lists.llvm.org/pipermail/llvm-dev/2017-September/117424.html

This patch makes two changes to the implementation of IVUsers' analysis
to make the result of the analysis more robust to instruction and
use list ordering:
A) Memoize the results of AddUsersImpl() each given instruction. The presence of
Processed.count(User) in the conditions that test for adding an instruction to the
current SCEV (approx lines 235 & 241) basically have the effect of changing the
return value of AddUsersImpl() for “interesting” instructions from true to false,
which results in different behaviour depending on the order in which instructions
are visited.

B) Don’t let the DFT continue into Users that are phi nodes in the loop-header.
We’re going to visit every phi node in the loop-header as the root of a DFT, anyways,
so this prevents the possibility of revisiting the same instruction multiple times
in the same def-use chain.


https://reviews.llvm.org/D38097

Files:
  include/llvm/Analysis/IVUsers.h
  lib/Analysis/IVUsers.cpp
  test/Analysis/IVUsers/invariant-out.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38097.116064.patch
Type: text/x-patch
Size: 7484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170920/55db0185/attachment.bin>


More information about the llvm-commits mailing list