aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/SROA.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-09-25 21:50:37 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-09-25 21:50:37 +0000
commit48c0f65be363eeec4d69a96864e06b1570aedbfe (patch)
treeed26f73d3077c58ff306243108d39c2aad513446 /lib/Transforms/Scalar/SROA.cpp
parentc3f10e43fc4b1084bc109ff740d9ba4b6eaced0a (diff)
downloadexternal_llvm-48c0f65be363eeec4d69a96864e06b1570aedbfe.zip
external_llvm-48c0f65be363eeec4d69a96864e06b1570aedbfe.tar.gz
external_llvm-48c0f65be363eeec4d69a96864e06b1570aedbfe.tar.bz2
Revert the business end of r164634, and replace it with a different fix. The
reason we were getting two of the same alloca is because of a memmove/memcpy which had the same alloca in both the src and dest. Now we detect that case directly. This has the same testcase as before, but fixes a clang test CodeGenObjC/exceptions.m which runs clang -O2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SROA.cpp')
-rw-r--r--lib/Transforms/Scalar/SROA.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp
index c33ee8f..1b3e8f9 100644
--- a/lib/Transforms/Scalar/SROA.cpp
+++ b/lib/Transforms/Scalar/SROA.cpp
@@ -2228,7 +2228,10 @@ private:
// alloca that should be re-examined after rewriting this instruction.
if (AllocaInst *AI
= dyn_cast<AllocaInst>(OtherPtr->stripInBoundsOffsets()))
- Pass.Worklist.insert(AI);
+ // Don't revisit the alloca if both sides of the memory transfer are
+ // referring to the same alloca.
+ if (AI != &NewAI)
+ Pass.Worklist.insert(AI);
if (EmitMemCpy) {
Value *OurPtr
@@ -3108,12 +3111,6 @@ 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) {