Fix (most?) DefLabel issues with pdce-inlining
commit9cb8ede1cf3beaeda3b2edeff2346d6a000ab9b5
authorRick Lavoie <rlavoie@fb.com>
Tue, 16 Jul 2019 16:19:42 +0000 (16 09:19 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 16 Jul 2019 16:23:36 +0000 (16 09:23 -0700)
tree066199f18a497428e46010cb0a402b3aa324ef8d
parentd8e019e016c467bb0bb3a42e7d52ddfcee9f49ba
Fix (most?) DefLabel issues with pdce-inlining

Summary:
The pdce-inlining frame optimization pass didn't tolerate
DefLabels of frames very well. The optimize phase is relatively easy
to deal with. We just decline to optimize any FramePtrs defined by a
DefLabel or used by a DefLabel (the later was already true). The
analysis phase is trickier, however (mainly to avoid asserting on
broken invariants). To deal with this, instead of keeping a single
"current FP", we instead keep a set of "current FPs". In most cases,
the set will only consider a single FP. However if the current FP is
defined by a DefLabel, and we encounter an InlineReturn or
InlineSuspend, we do not know which FP is active (because it could be
either input to the DefLabel). Instead, we mark both as "current". In
addition, whenever we need to perform an operation using these frame
pointers, we "resolve" them. This means walking upward and seeing how
they're defined. If they're defined by a DefFP or DefInlineFP, then
they're resolved to themselves. Otherwise, we recursively walk through
the DefLabel and do the same for its operands. Thus resolving a single
FP might result in a set. This ensures that we treat the DefLabels as
transparent. To avoid lots of redundant look back, the resolutions are
cached.

Also fix a bug in normal DCE where we also weren't dealing with
DefLabels properly.

Reviewed By: jano

Differential Revision: D16216150

fbshipit-source-id: c1c3b448bfac3b7149ac536f65dab7a81a4683e4
hphp/runtime/vm/jit/dce.cpp
hphp/runtime/vm/jit/pdce-inlining.cpp