[PATCH] D22778: Add Loop Sink pass to reverse the LICM based of basic block frequency.

Jun Bum Lim via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 13:32:01 PDT 2016


junbuml added a comment.

Are you going to have a separate patch to hook this in the pass manager ?


================
Comment at: lib/Transforms/Scalar/LoopSink.cpp:141
@@ +140,3 @@
+      if (dyn_cast<PHINode>(UI) ||
+          !L->contains(LI->getLoopFor(UI->getParent()))) {
+        BBs.clear();
----------------
Isn't it still okay to try to sink in outside the loop if the user block is cold enough?  

================
Comment at: lib/Transforms/Scalar/LoopSink.cpp:161
@@ +160,3 @@
+                BFI->getBlockFreq(SinkBB) + BFI->getBlockFreq(N)) {
+          SinkBBs.insert(SinkBB);
+          SinkBB = N;
----------------
Why not early return if frequency of SinkBB is greater than PreheaderFreq.

================
Comment at: lib/Transforms/Scalar/LoopSink.cpp:178
@@ +177,3 @@
+    for (BasicBlock *N : SinkBBs) {
+      if (!L->contains(LI->getLoopFor(SinkBB))) {
+        ShouldSkip = true;
----------------
I guess you intend  L->contains(LI->getLoopFor(N)) ?   



https://reviews.llvm.org/D22778





More information about the llvm-commits mailing list