Title | Optimization possibility for NOTREACHED in RASH variety |
Status | suspended |
Priority | nice |
Assigned user | Gareth Rees |
Organization | Ravenbrook |
Description | In the RASH variety we define NOTREACHED as expanding to NOOP. #define NOTREACHED NOOP Compilers would have more opportunities for optimization if we indicated that we believe this statement is not reachable. This might also improve the accuracy of the test coverage report; see job003443. |
Analysis | Both Clang/LLVM [1] and GCC [2] have a builtin for declaring to the compiler that a statement is unreachable, so for these compilers we could use: #define NOTREACHED __builtin_unreachable() RB says that there are other builtins for providing hints like "this is the more/less likely branch to take". For example, the various assertion macros could say "less likely" and that might prompt the compiler to move them out of the main line of execution. We would want to do some measurement before deciding that any of this was worthwhile, of course. GDR 2013-05-16: I tried this out, and it neither improves the runtime of the test suite, nor does it improve the accuracy of the coverage reporting. So I marked this job as suspended. |
How found | inspection |
Evidence | [1] <http://clang.llvm.org/docs/LanguageExtensions.html#builtin-unreachable >[2] < http://gcc.gnu.org/onlinedocs/gcc-4.5....t_005f_005fbuiltin_005funreachable-3030 > |
Observed in | 1.110.0 |
Created by | Gareth Rees |
Created on | 2013-03-14 14:26:59 |
Last modified by | Gareth Rees |
Last modified on | 2013-05-16 11:47:49 |
History | 2013-03-14 GDR Created. 2013-05-16 GDR Suspended. |