This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Emit a splat for v128 IMPLICIT_DEF
ClosedPublic

Authored by tlively on Dec 19 2018, 6:19 PM.

Details

Summary

This is a code size savings and is also important to get runnable code
while engines do not support v128.const.

Diff Detail

Repository
rL LLVM

Event Timeline

tlively created this revision.Dec 19 2018, 6:19 PM
  • So your intention was to do this even after we support v128.const, because it is code size savings, right?
  • So there were no assumptions broken after we insert a new instruction after stackification?
lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
130 ↗(On Diff #179003)

There is a version of BuildMI that takes an instruction before which a new instruction is inserted. With this you don't need to insert it explicitly after creation.

tlively updated this revision to Diff 179008.Dec 19 2018, 7:40 PM
  • Use BuildMI that inserts instruction
tlively marked an inline comment as done.Dec 19 2018, 7:42 PM
  • So your intention was to do this even after we support v128.const, because it is code size savings, right?

That's right. V8 not supporting v128.const just made it a little more urgent.

  • So there were no assumptions broken after we insert a new instruction after stackification?

Looks like it worked out. The insertion is a local, type-safe change that happens before the registers are stripped and the opcodes changed to their stack forms, so it seems ok.

aheejin accepted this revision.Dec 19 2018, 7:50 PM

LGTM with a nit.

lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
129 ↗(On Diff #179008)

You don't need .getInstr(); MachineInstrBuilder has a conversion operator to MachineInstr *.

This revision is now accepted and ready to land.Dec 19 2018, 7:50 PM
This revision was automatically updated to reflect the committed changes.
tlively marked an inline comment as done.