Next: compat Testing, Previous: gcov Testing, Up: Testsuites [Contents][Index]

### 7.7 Support for testing profile-directed optimizations

The file `profopt.exp` provides language-independent support for checking correct execution of a test built with profile-directed optimization. This testing requires that a test program be built and executed twice. The first time it is compiled to generate profile data, and the second time it is compiled to use the data that was generated during the first execution. The second execution is to verify that the test produces the expected results.

To check that the optimization actually generated better code, a test can be built and run a third time with normal optimizations to verify that the performance is better with the profile-directed optimizations. `profopt.exp` has the beginnings of this kind of support.

`profopt.exp` provides generic support for profile-directed optimizations. Each set of tests that uses it provides information about a specific optimization:

`tool`

  tool being tested, e.g., `gcc`

`profile_option`

  options used to generate profile data

`feedback_option`

  options used to optimize using that profile data

`prof_ext`

  suffix of profile data files

`PROFOPT_OPTIONS`

  list of options with which to run each test, similar to the lists for torture tests

`{ dg-final-generate { local-directive } }`

  This directive is similar to `dg-final`, but the local-directive is run after the generation of profile data.

`{ dg-final-use { local-directive } }`

  The local-directive is run after the profile data have been used.