[llvm-commits] [llvm] r164636 - /llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Nick Lewycky
nicholas at mxc.ca
Tue Sep 25 14:50:38 PDT 2012
Author: nicholas
Date: Tue Sep 25 16:50:37 2012
New Revision: 164636
URL: http://llvm.org/viewvc/llvm-project?rev=164636&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=164636&r1=164635&r2=164636&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Tue Sep 25 16:50:37 2012
@@ -2228,7 +2228,10 @@
// 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 @@
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) {
More information about the llvm-commits
mailing list