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

cmd/compile: improve codegen for nested if statements #21394

Open
josharian opened this Issue Aug 11, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@josharian
Contributor

josharian commented Aug 11, 2017

As observed in CL 54651, these two semantically equivalent bits of code do not always compile equivalently:

if a {
  if b {
   // ...
  }
}
if a && b {
  // ...
}

This issue is to investigate why, and if the latter is systematically better, consider improving the former. Note that 'if a && b' gets special handling at Node -> SSA time; phiopt.go does some further related cleanup, but perhaps not enough.

cc @randall77

@josharian josharian added this to the Unplanned milestone Aug 11, 2017

@mvdan

This comment has been minimized.

Member

mvdan commented Aug 11, 2017

Could this also apply to if a { if b := c(); b { ... } }?

@josharian

This comment has been minimized.

Contributor

josharian commented Aug 11, 2017

@mvdan potentially, depending on the details of c() and how it relates to a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment