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

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

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

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

josharian opened this issue Aug 11, 2017 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Performance
Milestone

Comments

@josharian
Copy link
Contributor

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
Copy link
Member

mvdan commented Aug 11, 2017

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

@josharian
Copy link
Contributor Author

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

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Performance
Projects
None yet
Development

No branches or pull requests

3 participants