https://bugs.llvm.org/show_bug.cgi?id=38492

            Bug ID: 38492
           Summary: Incorrect block frequencies for profile-optimized
                    compilation after jump threading
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: dcalla...@fb.com
                CC: llvm-bugs@lists.llvm.org

Created attachment 20660
  --> https://bugs.llvm.org/attachment.cgi?id=20660&action=edit
test case

This bug is reduced from the spec2017 602.gcc test which is compiled with a
sample-based profiling. 

After jump threading  the default compilation generates an wild execution
frequency for some blocks. If jump threading is disabled
(-jump-threading-threshold=0) then more reasonable frequencies are generated.
For example, diffing the output of -debug-only=block-freq illustrates

<  - while.body.i74: float = 1342177279.8, scaled = 28633115303.3, int =
28633115303
---
>  - while.body.i74: float = 60.15625113, scaled = 1283.333358, int = 1283

The relative frequency of 60 is plausible while the other is not.

Jump threading updates the branch weights in two places. Curiously one place is
explicitly disabled when the there are existing profile weights while the other
explicitly requires profiling to already be present. These choices interact
poorly when the first example finds on profile branch weights and so creates
them in a context the second seems it should not have them.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to