aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/SROA.cpp6
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) {