OSDN Git Service

[unroll] Change the other worklist in the unroll analyzer to be a set
authorChandler Carruth <chandlerc@gmail.com>
Fri, 13 Feb 2015 04:27:50 +0000 (04:27 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 13 Feb 2015 04:27:50 +0000 (04:27 +0000)
commitb9cb5b19d91ca570443e0dd09102bd611d36c4fc
treed58498c0466f8ffad7a9a8a6824602b4209df7ad
parent361ac0df6570558bd80b21e257a0a3e465cd20b4
[unroll] Change the other worklist in the unroll analyzer to be a set
vector.

In addition to dramatically reducing the work required for contrived
example loops, this also has to correct some serious latent bugs in the
cost computation. Previously, we might add an instruction onto the
worklist once for every load which it used and was simplified. Then we
would visit it many times and accumulate "savings" each time.

I mean, fortunately this couldn't matter for things like calls with 100s
of operands, but even for binary operators this code seems like it must
be double counting the savings.

I just noticed this by inspection and due to the runtime problems it can
introduce, I don't have any test cases for cases where the cost produced
by this routine is unacceptable.

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