[PATCH] D65148: [SimplifyCFG] Bump phi-node-folding-threshold from 2 to 3

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 04:54:52 PDT 2019


lebedev.ri added a comment.

In D65148#1660471 <https://reviews.llvm.org/D65148#1660471>, @lebedev.ri wrote:

> In D65148#1658556 <https://reviews.llvm.org/D65148#1658556>, @efriedma wrote:
>
> > > So, what metric specifically do you want to see, a count of CMOV instructions at the end of codegen, how it is changed by this patch?
> >
> > I guess more the number of branches at the end of codegen... because there are really three possibilities here: the select is lowered to cmov, the select is lowered to branch, or the select gets optimized to some non-select computation.   But yes, something like that. I would guess most of the selects generated this way can't be significantly optimized, so if everything is working correctly, most of them should be getting converted back to branches.
>
>
> Okay, wrote a pass to count the interesting metrics at the final pass in backend (D67240 <https://reviews.llvm.org/D67240>).
>  Numbers for RawSpeed:
>
> | metric                                 | old    | new    | cnt change | % change |  |
> | x86-mi-counting.NumMachineFunctions    | 10513  | 10513  | 0          | 0.00%    |
> | x86-mi-counting.NumMachineBasicBlocks  | 200350 | 200163 | -187       | -0.09%   |
> | x86-mi-counting.NumMachineInstructions | 3307866      | 3305504      | -2362      | -0.07%   |
> | x86-mi-counting.NumUncondBR            | 33479  | 33465  | -14        | -0.04%   |
> | x86-mi-counting.NumCondBR              | 91062  | 90908  | -154       | -0.17%   |
> | x86-mi-counting.NumCMOV                | 4195   | 4284   | 89         | 2.12%    |
> | x86-mi-counting.NumVecBlend            | 17     | 17     | 0          | 0.00%    |
> |
>
> As it is evident, while there is an increase in cmov count,
>  the decrease of branch count is almost twice that,
>  and there is notable decrease of total instruction count, basic block count.
>  I believe that supports the benchmark numbers.
>
> F9931070: results-old.json <https://reviews.llvm.org/F9931070> F9931071: results-new.json <https://reviews.llvm.org/F9931071>
>
> Does that line up with what you wanted to see?
>
> Will post test-suite numbers a bit later, not sure how to aggregate them..


@efriedma and done (these are vanilla llvm test-suite no externals, no rawspeed).
Did not find any nice way to auto-aggregate, so just applied some bash:

  $ touch x86-mi-counting.NumMachineFunctions x86-mi-counting.NumMachineBasicBlocks x86-mi-counting.NumMachineInstructions x86-mi-counting.NumUncondBR x86-mi-counting.NumCondBR x86-mi-counting.NumCMOV x86-mi-counting.NumVecBlend
  $ for i in x86-mi-counting.*; do echo -n "$i "; grep $i results-testsuite-old.json | awk '{print $2}' | sed "s/.0,//" | awk '{s+=$1}END{print s}'; done;



| metric                                 | old    | new    | cnt change | % change |
| x86-mi-counting.NumMachineFunctions    | 27189  | 27189  | 0          | 0.00%    |
| x86-mi-counting.NumMachineBasicBlocks  | 573079 | 571509 | -1570      | -0.27%   |
| x86-mi-counting.NumMachineInstructions | 4180244      | 4180750      | 506        | 0.01%    |
| x86-mi-counting.NumUncondBR            | 102271 | 102115 | -156       | -0.15%   |
| x86-mi-counting.NumCondBR              | 332645 | 331669 | -976       | -0.29%   |
| x86-mi-counting.NumCMOV                | 20620  | 21134  | 514        | 2.49%    |
| x86-mi-counting.NumVecBlend            | 0      | 0      | 0          | 0        |
|

Here the results aren't as glaring.
We again notably decreased BB count, increased CMOV count but decreased branch count by more than twice the CMOV increase, 
increased instruction count by a bit (the absolute number appears to match the increase in CMOV's);

F9932121: results-testsuite-old.json <https://reviews.llvm.org/F9932121> F9932122: results-testsuite-new.json <https://reviews.llvm.org/F9932122>


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65148/new/

https://reviews.llvm.org/D65148





More information about the llvm-commits mailing list