[PATCH] D36864: [Profile] backward propagate profile data in jump-threading

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 23:16:02 PDT 2017


davidxl created this revision.
Herald added a subscriber: sanjoy.

If a branch condition is defined by a function call result, the profile information for the branch may be (effectively) lost after inlinling.

For instance,

   bool cond() {
        if (a)
          return true;
        if (b)
          return true;
       return false;
   }
  
  void test() {
      if (__builtin_expect(cond(), false) ) {
           bar();  // cold
       }
     ..
   }

After inlining and jump threading, the first branch in the inline instance does not have profile data -- this will make the block for bar() look hot.

In this patch, the problem is fixed in jump threading by 'backward' propagate the BP to the predecessor given the conditional probability discovered.


https://reviews.llvm.org/D36864

Files:
  lib/Transforms/Scalar/JumpThreading.cpp
  test/Transforms/JumpThreading/threading_prof1.ll
  test/Transforms/JumpThreading/threading_prof2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36864.111620.patch
Type: text/x-patch
Size: 7454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170818/727a2535/attachment.bin>


More information about the llvm-commits mailing list