[PATCH] D19950: Use frequency info to guide Loop Invariant Code Motion.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 10:25:34 PDT 2016


danielcdh marked an inline comment as done.

================
Comment at: lib/Transforms/Scalar/LICM.cpp:353-355
@@ -346,3 +352,5 @@
   bool Changed = false;
-  if (!inSubLoop(BB, CurLoop, LI))
+  if (!inSubLoop(BB, CurLoop, LI)) {
+    bool ShouldHoist =
+        BFI->getBlockFreq(BB) >= BFI->getBlockFreq(CurLoop->getLoopPreheader());
     for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;) {
----------------
junbuml wrote:
> I agree that we still need to perform constant folding even when ShouldHoist is false?
yes


http://reviews.llvm.org/D19950





More information about the llvm-commits mailing list