[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)
commite5c30e4e10491107c8c6692a0150e624d561fd2a
treed6481206277eebcddac80410a010dfdfbd7fb984
parent7824bc9241e6ff970016f45540dfe0751bcda48a
[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.

llvm-svn: 229059
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp