[PATCH] New Loop Distribution pass
Adam Nemet
anemet at apple.com
Thu May 14 04:49:44 PDT 2015
Thanks, Arnold!
================
Comment at: lib/Transforms/Scalar/LoopDistribute.cpp:147
@@ +146,3 @@
+
+ /// \brief Moves \p Other into this partition. Other becomes empty after
+ /// this.
----------------
aschwaighofer wrote:
> Comment: It is the other way round. The code moves 'this' to the 'Other' partition.
Yeah, totally, the comment is backwards.
================
Comment at: lib/Transforms/Scalar/LoopDistribute.cpp:575
@@ +574,3 @@
+ void mergeAdjacentPartitionsIf(UnaryPredicate Predicate) {
+ for (auto I = PartitionContainer.begin(); I != PartitionContainer.end();) {
+ auto &FirstPartition = *I;
----------------
aschwaighofer wrote:
> Can we rewrite this nested loop to something like:
>
> InstPartion *PrevMatch = nullptr;
> for (auto It = PC.begin(); It != PC.end(); ) {
> auto DoesMatch = Predicate(*It);
> if (PreMatch == nullptr && DoesMatch) {
> PrevMatch = *It
> ++It;
> } else if (PreMatch != nullptr && DoesMatch) {
> *It->move_to(PrevMatch);
> It = PC.erase(It);
> } else {
> PrevMatch = nullptr;
> ++It;
> }
> }
>
Sure, if you prefer.
http://reviews.llvm.org/D8831
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list