[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:12:29 PDT 2016


danielcdh added inline comments.

================
Comment at: lib/Transforms/Scalar/LICM.cpp:357
@@ -346,3 +356,3 @@
   bool Changed = false;
   if (!inSubLoop(BB, CurLoop, LI))
     for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;) {
----------------
davidxl wrote:
> Better to do this:
> 
> if (ShouldHoist && !inSubLoop(BB, CurLoop, LI)) 
> 
> 
> Chad's suggestion of doing 
> 
> ShouldHoist = BFI->getBlockFreq(BB) >= .. is also good.
Updated with Chad's suggestion. But I cannot move the ShouldHoist check outside the loop because there is still constant folding opportunities inside the loop.


http://reviews.llvm.org/D19950





More information about the llvm-commits mailing list