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

Slicing keeps export functions that are called by kept functions #750

Closed
vbgl opened this issue Mar 13, 2024 · 0 comments · Fixed by #751
Closed

Slicing keeps export functions that are called by kept functions #750

vbgl opened this issue Mar 13, 2024 · 0 comments · Fixed by #751
Labels

Comments

@vbgl
Copy link
Member

vbgl commented Mar 13, 2024

The following program does not compile, even with -slice good:

/* On x86-64, c (4th argument) and n (2nd operand to shift)
 * must be allocated to the RCX register,
 * so this function cannot be compiled */
export
fn bad(reg u64 x y z c) -> reg u64 {
  reg u64 n;
  n = x;
  y <<= n & 63;
  x = y;
  x |= z;
  x |= c;
  return x;
}

// This function is fine, as c can be moved to an other free register
export
fn good(reg u64 x y z c) -> reg u64 {
  c = c;
  #[inline]
  x = bad(x, y, z, c);
  return x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant