[llvm-bugs] [Bug 27791] New: Block Frequencies for loop seem incorrect

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 17 10:31:57 PDT 2016


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

            Bug ID: 27791
           Summary: Block Frequencies for loop seem incorrect
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Global Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: k.alexis.perry at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16380
  --> https://llvm.org/bugs/attachment.cgi?id=16380&action=edit
source file

$ clang++ -O2 -fprofile-instr-generate ProfileTester.cpp -o ProfileTester
-fno-vectorize -fno-unroll-loops
$ LLVM_PROFILE_FILE="profiletester-%p.profraw" ./ProfileTester
Number of entries into the if statement: 11
The new x value is: 2.07692
The new c value is: 2.69231
$ llvm-profdata merge -output=profiletester.profdata profiletester-*.profraw
$ clang++ -O2 -fprofile-instr-use=profiletester.profdata ProfileTester.cpp -S
-emit-llvm -o ProfileTester-with-pd.ll -fno-vectorize -fno-unroll-loops
$ opt -analyze -block-freq < ProfileTester-with-pd.ll
Printing analysis 'Block Frequency Analysis' for function 'main':
block-frequency-info: main
 - entry: float = 1.0, int = 8388624
 - for.cond.cleanup: float = 1.0, int = 8388624
 - if.then.i145: float = 0.00000095367, int = 8
 - _ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit: float = 1.0, int = 8388616
 - if.then.i: float = 0.8, int = 6710892
 - if.end.i: float = 0.2, int = 1677723
 - _ZNKSt5ctypeIcE5widenEc.exit: float = 1.0, int = 8388616
 - if.then.i148: float = 0.00000095367, int = 8
 - _ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit150: float = 1.0, int = 8388607
 - if.then.i125: float = 0.8, int = 6710886
 - if.end.i129: float = 0.2, int = 1677721
 - _ZNKSt5ctypeIcE5widenEc.exit131: float = 1.0, int = 8388607
 - if.then.i152: float = 0.00000095367, int = 8
 - _ZSt13__check_facetISt5ctypeIcEERKT_PS3_.exit154: float = 1.0, int = 8388599
 - if.then.i137: float = 0.8, int = 6710879
 - if.end.i141: float = 0.2, int = 1677720
 - _ZNKSt5ctypeIcE5widenEc.exit143: float = 1.0, int = 8388599
 - for.body: float = 5001.5, int = 41955695043
 - for.body7: float = 55012.0, int = 461475390211
 - for.cond.cleanup25: float = 55012.0, int = 461475390211
 - for.body26: float = 275030036.0, int = 2307123560708599
 - if.end.loopexit: float = 6.0006, int = 50336765
 - if.end: float = 5001.5, int = 41955695043

Printing analysis 'Block Frequency Analysis' for function
'_GLOBAL__sub_I_ProfileTester.cpp':
block-frequency-info: _GLOBAL__sub_I_ProfileTester.cpp
 - entry: float = 1.0, int = 8

Please note:
 - for.body: float = 5001.5, int = 41955695043

This is a top-level loop with a static trip count of 10000. Thus, its loop
header should execute 10000 times as frequently as the function entry block.
The reported frequency is ~5000 times. This seems off by a factor of 2.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160517/ada6539f/attachment-0001.html>


More information about the llvm-bugs mailing list