use LdTypeStructureVal in IR optimization pass
commit3df8c1aa8ae34f595cecae29db16e198ebdd8bdd
authorSally Zhou <sallyz@fb.com>
Thu, 7 Jul 2022 21:42:35 +0000 (7 14:42 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 7 Jul 2022 21:42:35 +0000 (7 14:42 -0700)
tree33b5b33b196b2b76487aebaa448dbcca80250ac5
parent0fa85515fc1f5d1d8e1412cb1b16c0144c49198e
use LdTypeStructureVal in IR optimization pass

Summary:
Add logic in `opt.cpp` to change BespokeGet and BespokeGetThrow into LdTypeStructureVal when the array is a bespoke type structure. We were only converting in `irgen-bespoke.cpp` before, which might not catch all bespoke cases.

This is similar logic to the current process for lowering StructDicts in `opt.cpp`: we loop through all arrays and check if any of them are bespoke type structs, then call the appropriate function to convert the IR instruction. Since LdTypeStructureVal is a branching instruction, the new control flow will add some new blocks.

Also fixed a small bug in `irlower-bespoke.cpp` so that we only set `dst.reg(1)` if the return type of the field is unknown.

Reviewed By: paulbiss

Differential Revision: D37429307

fbshipit-source-id: 60de5e153557e6a7e6282c651a5deb4eaf5425d5
hphp/runtime/vm/jit/irgen-bespoke.cpp
hphp/runtime/vm/jit/irgen-bespoke.h
hphp/runtime/vm/jit/irlower-bespoke.cpp
hphp/runtime/vm/jit/opt.cpp