Refactor the SROA visitors for partitioning an alloca and building
authorChandler Carruth <chandlerc@gmail.com>
Sun, 16 Sep 2012 19:39:50 +0000 (19:39 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 16 Sep 2012 19:39:50 +0000 (19:39 +0000)
commit63392ea3ba295d59260553245b14a435b5f71a3e
tree84795ca9cf4a8128f4c993f21876c28d6980bc9c
parentaf8d66ce9a9ebac0bf5629f3e39e78e57173c386
Refactor the SROA visitors for partitioning an alloca and building
partition use lists a bit. No functionality changed.

These visitors are actually visiting a tuple of a Use and an offset into
the alloca. However, we use the InstVisitor to handle the dispatch over
the users, and so the Use and Offset are stored in class member
variables and set just before each call to visit(). This is fairly
awkward and makes the functions a bit harder to read, but its the only
real option we have until InstVisitor can be rewritten to use variadic
templates.

However, this pattern shouldn't be followed on the helper member
functions where there is no interface constraint from the visitor. We
already were passing the instruction as a normal parameter rather than
use the Use to get at it, start passing the offset as well. This will
become more important in subsequent patches as the offset will in some
cases change while visiting a single instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164003 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SROA.cpp