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