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

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 05:56:35 PDT 2016


mcrosier added a subscriber: mcrosier.
mcrosier added a comment.

Do you have any performance data to back your claim?


================
Comment at: lib/Transforms/Scalar/LICM.cpp:347
@@ +346,3 @@
+  bool ShouldHoist = true;
+  if (BFI->getBlockFreq(BB) < BFI->getBlockFreq(CurLoop->getLoopPreheader()))
+    ShouldHoist = false;
----------------
This could be simplified to:

  bool ShouldHoist = BFI->getBlockFreq(BB) >= BFI->getBlockFreq(CurLoop->getLoopPreheader();

and should probably be places inside the if (!inSubLoop(BB, CurLoop, LI)) scope.  I.e.,

  if (!inSubLoop(BB, CurLoop, LI)) {
    bool ShouldHoist = BFI->getBlockFreq(BB) >= BFI->getBlockFreq(CurLoop->getLoopPreheader();
    for (...)
      ...
  }

================
Comment at: test/Other/pass-pipelines.ll:40
@@ -39,1 +39,3 @@
 ; CHECK-O2: Loop Pass Manager
+; CHECK-O2: Branch Probability Analysis
+; CHECK-O2: Block Frequency Analysis
----------------
I may be missing something here, but is this test even relevant to this patch?


http://reviews.llvm.org/D19950





More information about the llvm-commits mailing list