diff options
| author | Thomas Bauereiss | 2018-01-17 15:08:28 +0000 |
|---|---|---|
| committer | Thomas Bauereiss | 2018-01-17 16:28:38 +0000 |
| commit | 3216b9307830895b8c76725d8aea8936a0aca181 (patch) | |
| tree | dc2b7bebcbf081fcad8bd44e0854babb102d8475 /src/util.mli | |
| parent | 01a7c0eb317610acee9a79b24a5fa36ee78b6e07 (diff) | |
Try to remove early returns more aggressively
In particular, there is an ASL pattern with single-branch if-expressions
containing an early return (and an empty else-branch), e.g.
{
...
if (error) then return(Fault) else ();
...
return(Success);
}
The rewriting pass now tries to fold the rest of the block into the
else-branch, since it is unreachable after the then-branch, e.g.
{
...
if (error) then return(Fault) else {
...
return(Success);
}
}
In combination with other rewriting rules, this allows the rewriting pass to
pull out the early returns if *all* branches end in a return statement. If it
is possible to pull out the return all the way, i.e., so that the function body
is a single return statement, then the return can be removed. If that is not
possible, then the function body is left as it was originally.
Diffstat (limited to 'src/util.mli')
0 files changed, 0 insertions, 0 deletions
