[PATCH] SROA: Defer migrating the debug info for new allocas until after all partitions are created.
Chandler Carruth
chandlerc at gmail.com
Mon Dec 22 18:08:14 PST 2014
Is it possible to craft a test case for this? I'm thinking an alloca which needs rewriting but not splitting...
================
Comment at: lib/Transforms/Scalar/SROA.cpp:3600
@@ +3599,3 @@
+ uint64_t Size;
+ Piece(AllocaInst *AI, uint64_t O, uint64_t S)
+ : Alloca(AI), Offset(O), Size(S) {}
----------------
Just call the parameters the same name as the members. This does the right thing in the initializer list. I would probably use AI, Offset, and Size.
================
Comment at: lib/Transforms/Scalar/SROA.cpp:3603
@@ +3602,3 @@
+ };
+ std::vector<Piece> Pieces;
+
----------------
I think you at least want a smallvector with 1 piece in it.
================
Comment at: lib/Transforms/Scalar/SROA.cpp:3611-3612
@@ -3618,1 +3610,4 @@
+
+ // FIXME: See related comment in rewritePartition.
+ Changed = true;
++NumPartitions;
----------------
Any reason not to actually handle the null case for now? I think the code would be pretty clean:
if (AllocaInst *NewAI = rewritePartition(AI, AS, P)) {
Changed = true;
if (NewAI != &AI)
Pieces.push_back(...);
}
++NumPartitions;
================
Comment at: lib/Transforms/Scalar/SROA.cpp:3627
@@ +3626,3 @@
+ /*AllowUnresolved*/ false);
+ bool didSplit = Pieces.size() > 1;
+ for (auto Piece : Pieces) {
----------------
I would say:
bool IsSplit = ...;
http://reviews.llvm.org/D6766
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list