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 | 9f19349846c3e22c146badf14f3ea84c44979956 (patch) | |
| tree | 3fe4aba65073ec0ce83e920598a72c6a186ea360 /llvm/lib | |
| parent | 17e118b79c75497557a9ecaad3f7f5e21ca2d9e9 (diff) | |
| download | bcm5719-llvm-9f19349846c3e22c146badf14f3ea84c44979956.tar.gz bcm5719-llvm-9f19349846c3e22c146badf14f3ea84c44979956.zip | |
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.
llvm-svn: 164634
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SROA.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index b3e63ae355d..c33ee8fb875 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/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) { |

