Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000117 [libFirm] optimisations minor N/A 2013-09-03 23:30 2014-09-10 12:51
Reporter Matze View Status public  
Assigned To
Priority normal Resolution open  
Status confirmed   Product Version
Summary 0000117: Detect and optimize noreturn calls in optimize_funccalls
Description noreturn calls can be found a lot in error handling paths which often end in abort() or similar. In many projects they are hidden in wrapper functions which first report an error before calling abort().

Infering noreturn should be easy (just look if there are any return statement in the function). We should then be able to eliminate some control flow paths from the executables.

void panic(const char *msg) { fprintf(stderr, "%s\n", msg); abort(); }

void normal_code(void) {
   // ...
   if (...) { panic("foo"); }

Here we could infer that panic() will never return (because abort is noreturn). This can be used to guide optimisations:
* noreturn functions do not need to be inlined (decrease code size)
* noreturn functions remove paths from the control flow graph which can trigger other optimisations. This needs actual support in form as currently noreturn is only handlded by the cparser frontend when constructing such calls, we should have a phase in localopt, opt_funccall or maybe optimize_control_flow that removes code (esp. jumps) after noreturn calls.
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
Matze (administrator)
2014-09-10 12:51

Detection code has been implemented in f5733374171db4987b27839784bc5a3cfd3174e3 but we still lack a transformation

- Issue History
Date Modified Username Field Change
2013-09-03 23:30 Matze New Issue
2013-09-03 23:31 Matze Status new => confirmed
2013-09-19 23:21 Matze Description Updated
2013-09-19 23:27 Matze Description Updated
2014-09-10 12:51 Matze Note Added: 0000221

Mantis 1.1.5[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker