Allow refcount opts to operate across phi nodes
commit49109371d301cd59af02aa8a72710eb6aff22bb2
authorMark Williams <mwilliams@fb.com>
Mon, 11 Jun 2018 13:38:34 +0000 (11 06:38 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Mon, 11 Jun 2018 16:29:50 +0000 (11 09:29 -0700)
tree238e1faa9b9c71936c45fe27272a69ba94a2ec49
parentf1ce30f5bedce068f083af0b2a3dfec3ed4f8c0b
Allow refcount opts to operate across phi nodes

Summary:
Given a phi with Inc/DecRefs on its inputs, and Dec/IncRefs on the corresponding outputs, we can apply PRE in pretty much the same way we would elsewhere.

This also renames for_aset as if_aset (since it either operates on a single aset, or it doesn't), and adds a lookup_aset which returns a folly::Optional<ASetID>, so that

  if (aset = lookup_aset(tmp)) { func(*aset); }

is equivalent to

  if_aset(tmp, func);

I found that both forms were convenient, depending on the circumstances.

Reviewed By: swtaarrs

Differential Revision: D8127663

fbshipit-source-id: c8aa041f34a60df2ed18c25a2dcbdc6b5f32b74b
hphp/runtime/vm/jit/refcount-opts.cpp