[PM] Use a SmallVector instead of std::vector to avoid heap allocations
authorChandler Carruth <chandlerc@gmail.com>
Sat, 24 Jan 2015 10:47:13 +0000 (10:47 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 24 Jan 2015 10:47:13 +0000 (10:47 +0000)
commit3f5e7b1fb66a6faf43adb56b6c883364081610d2
treefee3cb6245c30f4de6c47d9874f8c41a6406328b
parent0012c778a4cca03ecc5e197dd33ce87a62d6bae7
[PM] Use a SmallVector instead of std::vector to avoid heap allocations
for small switches, and avoid using a complex loop to set up the
weights.

We know what the baseline weights will be so we can just resize the
vector to contain all that value and clobber the one slot that is
likely. This seems much more direct than the previous code that tested
at every iteration, and started off by zeroing the vector.

llvm-svn: 226995
llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp