Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused return is not recursive #837

Open
eponier opened this issue Jun 14, 2024 · 0 comments
Open

Remove unused return is not recursive #837

eponier opened this issue Jun 14, 2024 · 0 comments

Comments

@eponier
Copy link
Contributor

eponier commented Jun 14, 2024

If removing a return reveals a new opportunity to remove a return, the compiler does not take advantage of it.

For instance,

fn g () -> reg u32 {
  reg u32 x;
  x = 0;
  return x;
}

fn f () -> reg u32 {
  reg u32 x;
  x = g ();
  return x;
}

export fn main () -> reg u32 {
  reg u32 res;
  res = 0;
  _ = f();
  return res;
}

The compiler removes the return value of f and thus could remove the return value of g, but it does not do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant