[PATCH] D16057: [SROA] Fix for PR25873: Pre-splitting should always preserve the partition structure.
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 2 11:25:02 PST 2016
chandlerc added a comment.
Sorry its taken so long to cycle back here.
================
Comment at: lib/Transforms/Scalar/SROA.cpp:3611-3618
@@ -3610,1 +3610,10 @@
+ // We need to check if this store uses a slice of the alloca. If so, then
+ // we have to remember to build a new slice for each split store, and
+ // kill the original slice. Otherwise we risk to leave the partition
+ // structure in an inconsistent state.
+ auto StoreSlice = std::find_if(AS.begin(), AS.end(), [&](const Slice &S) {
+ return !S.isDead() && SI == S.getUse()->getUser();
+ });
+ bool UpdateSlices = StoreSlice != AS.end();
+
----------------
This test is pretty expensive. I think you want to instead build a map from stores to slices above when we are scanning the alloca slices.
================
Comment at: lib/Transforms/Scalar/SROA.cpp:3653
@@ +3652,3 @@
+ // it is no longer promotable.
+ if (!UpdateSlices) {
+ if (AllocaInst *OtherAI = dyn_cast<AllocaInst>(StoreBasePtr)) {
----------------
You can re-order things to handle the smaller of these cases as an early 'continue' path I think.
http://reviews.llvm.org/D16057
More information about the llvm-commits
mailing list