Skip to content

SSA pass#1049

Merged
kripken merged 47 commits intomasterfrom
ssa2
Jun 13, 2017
Merged

SSA pass#1049
kripken merged 47 commits intomasterfrom
ssa2

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented Jun 10, 2017

This adds a pass to move to SSA form, i.e., each local has a single assign. (See comment in pass source about phis, we don't add a phi node here.)

This has a worst-case runtime of max-loop-depth * max(num-locals, num-uses) * max-defs-for-local. I don't know how that compares to typical ways of doing SSA reconstruction - curious if anyone knows offhand? Anyhow, it seems like a reasonable worst-case.

Goals of this PR:

  • Improve our ability to optimize partially-optimized code from other compilers, like the wasm backend, or input not in SSA form, like AssemblyScript. We'll need more tools here before it makes sense to measure in depth, I plan to get to that next.
  • A possible step towards a full SSA+phis IR in binaryen, which as discussed in the past, we may want in the future.

This PR also includes a few tiny bug fixes that this uncovered, and improvements that made doing this easier. That includes an InstrumentLocals pass, like InstrumentMemory but for locals, which was very useful to debug this.

@kripken kripken merged commit b5b40c9 into master Jun 13, 2017
@kripken kripken deleted the ssa2 branch June 13, 2017 23:05
@kripken kripken mentioned this pull request Jun 16, 2017
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

Successfully merging this pull request may close these issues.

1 participant