[PATCH] D54181: [LoopSink] Do not sink instructions into non-cold blocks

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 13:51:47 PST 2018


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm with some minor suggestions



================
Comment at: lib/Transforms/Scalar/LoopSink.cpp:206
+    for (auto *BB : BBsToSinkInto)
+      if (LoopBlockNumber.find(BB) == LoopBlockNumber.end())
+        return false;
----------------
Maybe `!LoopBlockNumber.count(BB)`?


================
Comment at: lib/Transforms/Scalar/LoopSink.cpp:210
+
   if (BBsToSinkInto.empty())
     return false;
----------------
I'd do it after the empty check to put it closer to the lookup with `.find` below.


================
Comment at: test/Transforms/LICM/loopsink-pr39570.ll:53
+; <label>:5:                                      ; preds = %3
+  %6 = getelementptr inbounds %0, %0* %2, i32 undef, i32 4
+  br i1 undef, label %18, label %7, !prof !3
----------------
In the future, I recommend using creduce instead of bugpoint to reduce test cases like these. You will end up with a test that is much less fragile to changes in the way we fold undef.


Repository:
  rL LLVM

https://reviews.llvm.org/D54181





More information about the llvm-commits mailing list