diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-09-25 21:15:50 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-09-25 21:15:50 +0000 |
commit | c3f10e43fc4b1084bc109ff740d9ba4b6eaced0a (patch) | |
tree | 992ee824143c08c0e61cefc1a5a4dbe7be0cb880 /lib/Transforms | |
parent | ba48ceb1a3802e20e781ef04ea2573ffae2ac414 (diff) |
Don't try to promote the same alloca twice. Fixes PR13916!
Chandler, it's not obvious that it's okay that this alloca gets into the list
twice to begin with. Please review and see whether this is the fix you really
want, but I wanted to get a fix checked in quickly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164634 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/SROA.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp index b3e63ae355..c33ee8fb87 100644 --- a/lib/Transforms/Scalar/SROA.cpp +++ b/lib/Transforms/Scalar/SROA.cpp @@ -3108,6 +3108,12 @@ bool SROA::promoteAllocas(Function &F) { if (PromotableAllocas.empty()) return false; + // Ensure that the list is unique. + std::sort(PromotableAllocas.begin(), PromotableAllocas.end()); + PromotableAllocas.erase(std::unique(PromotableAllocas.begin(), + PromotableAllocas.end()), + PromotableAllocas.end()); + NumPromoted += PromotableAllocas.size(); if (DT && !ForceSSAUpdater) { |