[PATCH] D36864: [Profile] backward propagate profile data in jump-threading
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 21 20:00:39 PDT 2017
chandlerc accepted this revision.
chandlerc added a comment.
Cool! With the changes below, LGTM.
Any further testing you think this needs before relanding it? (I don't really have good ideas other than to patch it in internally and build some large things with PGO and ThinLTO)
================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:184-188
+ if(auto *SinglePredBB = PredBB->getSinglePredecessor()) {
+ SuccBB = PredBB;
+ PredBB = SinglePredBB;
+ } else
+ return {nullptr, nullptr};
----------------
I think this will be easier to read inverted:
auto *SinglePredBB = PredBB->getSinglePredecessor();
if (!SinglePredBB)
return {nullptr, nullptr};
SuccBB = PredBB;
PredBB = SinglePredBB;
================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:189
+ return {nullptr, nullptr};
+ } while(true);
+
----------------
nit: When infinitely looping, I find ` for (;;) {` a shorter and still easy to read idiom.
================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:190-191
+ } while(true);
+
+ return {nullptr, nullptr};
+ };
----------------
No need for this once the loop above returns directly when exiting.
https://reviews.llvm.org/D36864
More information about the llvm-commits
mailing list