[Bug middle-end/70897] New: Confused branch predictors

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun May 1 22:44:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70897

            Bug ID: 70897
           Summary: Confused branch predictors
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

Martin has collected predictor hitrates with current mainline. It seems that
some of predictors no longer works very well. In particular:

loop iv compare, continue, const return, fail alloc, zero-sized array, early
return (on trees), call all have very low hitrates.

This is a regression wrt early GCC 4.x releases when the regular predictor
testing broke.

SPECv6:
HEURISTICS                           BRANCHES  (REL)  HITRATE               
COVERAGE COVERAGE  (REL)
loop iv compare                            70   0.1%  59.31% /  71.45%     
391732444  391.73M   0.0%
unconditional jump                        252   0.2% 100.00% / 100.00%         
62269   62.27K   0.0%
guess loop iv compare                     362   0.3%  89.02% /  90.08%    
2703184164    2.70G   0.2%
continue                                  429   0.4%  12.85% /  90.20%   
37779791284   37.78G   2.9%
negative return                           919   0.8%  54.79% /  57.15%   
11577463479   11.58G   0.9%
null return                              1083   1.0%  99.73% /  99.96%     
673967611  673.97M   0.1%
const return                             1120   1.0%  11.66% /  96.19%    
1856118902    1.86G   0.1%
fail alloc                               1151   1.1%  57.13% / 100.00%        
144823  144.82K   0.0%
zero-sized array                         1960   1.8%  51.41% /  98.82%        
104224  104.22K   0.0%
loop guard                               3229   3.0%  76.78% /  82.17%   
60212618544   60.21G   4.6%
noreturn call                            3434   3.2% 100.00% / 100.00%    
1910587253    1.91G   0.1%
overflow                                 3755   3.4% 100.00% / 100.00%        
208357  208.36K   0.0%
opcode values positive (on trees)        5759   5.3%  58.56% /  82.94%   
59387315517   59.39G   4.6%
loop iterations                          7019   6.4%  87.65% /  87.65%  
229118021898  229.12G  17.6%
early return (on trees)                  8564   7.9%  52.30% /  80.93%   
42808951372   42.81G   3.3%
loop exit                                9158   8.4%  89.47% /  92.47%  
230993449420  230.99G  17.7%
opcode values nonequal (on trees)        9552   8.8%  85.86% /  91.56%   
92785638348   92.79G   7.1%
guessed loop iterations                 10880  10.0%  94.45% /  94.78%  
367779299495  367.78G  28.2%
pointer (on trees)                      18682  17.2%  80.01% /  94.69%   
18291859871   18.29G   1.4%
no prediction                           20863  19.2%  40.36% /  83.66%  
203021057312  203.02G  15.6%
first match                             33795  31.0%  91.59% /  92.17%  
820741493723  820.74G  63.0%
call                                    34820  32.0%  56.19% /  90.09%   
62586683178   62.59G   4.8%
DS theory                               54257  49.8%  66.02% /  86.54%  
280009272372  280.01G  21.5%
combined                               108915 100.0%  78.12% /  89.63% 
1303771823407    1.30T 100.0%


HEURISTICS                           BRANCHES  (REL)  HITRATE               
COVERAGE COVERAGE  (REL)
loop iv compare                            23   0.0%  52.06% /  52.15%       
8806901    8.81M   0.0%
unconditional jump                        103   0.2% 100.00% / 100.00%        
491001  491.00K   0.0%
guess loop iv compare                     133   0.3%  97.78% /  97.81%    
4279936888    4.28G   0.4%
negative return                           279   0.5%  97.87% /  99.23%    
1062639875    1.06G   0.1%
const return                              362   0.7%  34.63% /  89.75%     
380299097  380.30M   0.0%
null return                               396   0.8%  91.47% /  93.08%    
3268678453    3.27G   0.3%
continue                                  438   0.8%  33.36% /  82.86%    
9985282412    9.99G   0.9%
fail alloc                                595   1.2%  62.18% / 100.00%         
  595   595.00   0.0%
zero-sized array                          677   1.3% 100.00% / 100.00%     
112723789  112.72M   0.0%
overflow                                 1282   2.5% 100.00% / 100.00%     
175074149  175.07M   0.0%
loop guard                               1806   3.5%  51.80% /  84.49%    
5230926398    5.23G   0.5%
noreturn call                            2326   4.5% 100.00% / 100.00%    
7930483860    7.93G   0.7%
loop iterations                          2729   5.3%  75.43% /  75.43%  
531785147496  531.79G  47.8%
opcode values positive (on trees)        3125   6.1%  60.97% /  90.49%   
15436912826   15.44G   1.4%
guessed loop iterations                  5195  10.1%  93.61% /  94.10%  
209393449998  209.39G  18.8%
loop exit                                5339  10.4%  86.45% /  89.08%   
81667429878   81.67G   7.3%
early return (on trees)                  6129  11.9%  53.73% /  85.87%   
32874618464   32.87G   3.0%
pointer (on trees)                       6244  12.1%  69.66% /  87.21%   
16710418134   16.71G   1.5%
opcode values nonequal (on trees)        6595  12.8%  66.23% /  80.61%   
71478573496   71.48G   6.4%
no prediction                            8332  16.2%  32.83% /  84.55%  
136479915877  136.48G  12.3%
call                                    15873  30.8%  63.45% /  92.77%   
41601586641   41.60G   3.7%
first match                             16619  32.2%  81.34% /  81.68%  
828056982571  828.06G  74.4%
DS theory                               26610  51.6%  64.93% /  85.46%  
148555198747  148.56G  13.3%
combined                                51561 100.0%  73.20% /  82.54% 
1113092097195    1.11T 100.0%


More information about the Gcc-bugs mailing list