diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-04-26 01:05:00 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-04-26 01:05:00 +0000 |
commit | 30ffc4ce452db846f17f2a792392fc5a55af92ef (patch) | |
tree | 2dbb52d4cb579a631091bdea56274064eca4fc18 /llvm/lib/Transforms/Scalar/SROA.cpp | |
parent | 1aa3cf7d18aa463d42197844ce46a2bc785e9979 (diff) | |
download | bcm5719-llvm-30ffc4ce452db846f17f2a792392fc5a55af92ef.tar.gz bcm5719-llvm-30ffc4ce452db846f17f2a792392fc5a55af92ef.zip |
[SROA] Don't falsely report that changes have occured
We would report that the function changed despite creating no new
allocas or performing any promotion.
This fixes PR27316.
llvm-svn: 267507
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SROA.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SROA.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index b655c7449d2..6f65d909131 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -3920,15 +3920,19 @@ AllocaInst *SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS, Worklist.insert(NewAI); } } else { - // If we can't promote the alloca, iterate on it to check for new - // refinements exposed by splitting the current alloca. Don't iterate on an - // alloca which didn't actually change and didn't get promoted. - if (NewAI != &AI) - Worklist.insert(NewAI); - // Drop any post-promotion work items if promotion didn't happen. while (PostPromotionWorklist.size() > PPWOldSize) PostPromotionWorklist.pop_back(); + + // We couldn't promote and we didn't create a new partition, nothing + // happened. + if (NewAI == &AI) + return nullptr; + + // If we can't promote the alloca, iterate on it to check for new + // refinements exposed by splitting the current alloca. Don't iterate on an + // alloca which didn't actually change and didn't get promoted. + Worklist.insert(NewAI); } return NewAI; |