summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-10-02 22:46:45 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-10-02 22:46:45 +0000
commitb09f0a3c75f3c5aa2ba309ddcb4e21d60053b130 (patch)
tree551521010643a56abbe27967eb7499589f367fcb /llvm/lib/Transforms
parent0f40a3e795ee1afb61f4db2a4cea573acf5386d4 (diff)
downloadbcm5719-llvm-b09f0a3c75f3c5aa2ba309ddcb4e21d60053b130.tar.gz
bcm5719-llvm-b09f0a3c75f3c5aa2ba309ddcb4e21d60053b130.zip
Teach the new SROA to handle cases where an alloca that has already been
scheduled for processing on the worklist eventually gets deleted while we are processing another alloca, fixing the original test case in PR13990. To facilitate this, add a remove_if helper to the SetVector abstraction. It's not easy to use the standard abstractions for this because of the specifics of SetVectors types and implementation. Finally, a nice small test case is included. Thanks to Benjamin for the fantastic reduced test case here! All I had to do was delete some empty basic blocks! llvm-svn: 165065
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 61d49faf38d..58c3bc0f200 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -3302,7 +3302,11 @@ bool SROA::runOnFunction(Function &F) {
while (!Worklist.empty()) {
Changed |= runOnAlloca(*Worklist.pop_back_val());
deleteDeadInstructions(DeletedAllocas);
+
+ // Remove the deleted allocas from various lists so that we don't try to
+ // continue processing them.
if (!DeletedAllocas.empty()) {
+ Worklist.remove_if(IsAllocaInSet(DeletedAllocas));
PromotableAllocas.erase(std::remove_if(PromotableAllocas.begin(),
PromotableAllocas.end(),
IsAllocaInSet(DeletedAllocas)),
OpenPOWER on IntegriCloud