Dump typedef info in `hh_client --show`

Summary: Occasionally useful.

Reviewed By: @int3, @elgenie

Differential Revision: D1695998

Signature: t1:1695998:1416530544:befee9d06783c4130d824db3191905f7a20587f7
Cleanup of hfsort

Summary: I want to embed the core of hfsort into hhvm to use for perf based
jit relocation, so move it into its own namespace, and move error() and TRACE
out of the core so they can be replaced with something more appropriate when
running from hhvm.

Reviewed By: @ottoni

Differential Revision: D1697874

Signature: t1:1697874:1416607428:0c68d05310bd047b6bf7d9db4be8dceeb5dbaaab
Fix headerTest

Summary: It was written to the old api

Reviewed By: @alexmalyshev

Differential Revision: D1698880

Signature: t1:1698880:1416617532:3111a9d67b0624be5cbfccbea7bf019a192028e2
typechecker: add constants to hh_client --show

Summary: ... it's valuable for checking whether a builtin constant is declared.

Reviewed By: @jwatzman

Differential Revision: D1696607

Signature: t1:1696607:1416616316:bb07a63e2dd07da4ac39014ea8fbc0252ecba5b0
Use sha1sum for the repo-schema

Summary: it turns out that shasum isn't installed in the sandcastle
tupperware containers.

Reviewed By: @edwinsmith
Map operator new/delete directly to malloc/free

Summary: They used to go through the plt, which caused extra cache
misses and extra instructions.

Reviewed By: @edwinsmith

Differential Revision: D1698182

Signature: t1:1698182:1416607907:6e44c34a3e31a56afaa93b367d83f2bdc9e68745
Re-order some runtime options

Summary: Some Eval options needed to know the value of RepoAuthoritative,
so move the Repo section higher up, rather than splitting the Eval
options.

I was adding some more options that needed to know about RepoAuthoritative,
so this seemed to make sense.

Reviewed By: @JoelMarcey

Differential Revision: D1697691

Signature: t1:1697691:1416598948:1fd0ce678e90cbff1051afc9e49d665ceec1497d
Flip DParam and DParamNRel, so NRel is the default

Summary: Only LdLoc and LdStack need this.  The LdLocPseudoMain support didn't
seem to be entirely working: when we gen'd new LdLocPseudoMains, we'd map their
type sources to whatever the current type source was, and LdLocPseudoMain would
set its own dst as a type source.  Right now it's also setting types in
localTypes which are incorrect without a new guard (this could cause problems
for any callers of localType, but I don't know if it can just be removed, so I
made a task).  So any constrainValue on a LdLocPseudoMain would constrain the
/previous/ LdLocPseudoMain in the tracelet.  However, isGuardOp returns false
for these, so it can't have worked.  Also I don't understand why
StLocPseudoMain was modifying type srcs, so just remove that too.

Reviewed By: @markw65

Differential Revision: D1687087

Signature: t1:1687087:1416589588:d25561f895d2c6b994366485dc372493e0d6ff9e
Fix insertPhis calls to IRUnit::replace()

Summary: It was trying to replace a jump but passing no destination block.  Due
to a bug in IRInstruction::become this actually worked, because it left the old
Edges in place.  It also seems really sketchy to iterate the predecessor
EdgeList while you're modifying instructions that change it; I'm not sure if
that's ok (it probably could be if we guarantee not to move the Edge*'s if it
already had Edges, but that seems like a weird thing to rely on), so stop doing
it.  The function does something pretty similar a few lines earlier while
splitting critical edges also, but this part is explicitly doing setTaken and
setNext calls without anything that could be changing the Edge*, which seems
like it /might/ work, so I'm going to leave that part alone for now.

Reviewed By: @bertmaher

Differential Revision: D1693126

Signature: t1:1693126:1416451300:c4c3dafb5de2c6b92828fb4dd4ecc359e0fdb6cd
Fix bugs relating to edges in IRInstruction::become

Summary: It was keeping the edges from the old branch if you replace one branch
with another, if you replaced a non-branch with a branch, it would call
setNext/setTaken before changing m_op so they wouldn't do anything, and if it
allocated edges it didn't set their instruction pointers.

Reviewed By: @edwinsmith

Differential Revision: D1689306

Signature: t1:1689306:1416503105:5f54a7526d1fe128044c5831683a189ce24a3d1c
Remove IRInstruction::convertToJmp, and IRInstruction::convertToNop

Summary: The comments about the simplifier (which doesn't even call these
anymore) were pretty scary.  Now become() works for jumps, so we can just use
it.  convertToMov was dead.  convertToNop seems common enough to have a special
function (and it lets you do it without an IRUnit).

Reviewed By: @ottoni

Differential Revision: D1689348

Signature: t1:1689348:1416595146:3806ebc30697603cb6a9fa7a7afea9518a84542b
Merging function for sparse_id_maps

Summary: To use these to contain dataflow state you'll generally want to have
something like this.  It turns out I have a better way for now, but this was
tested and seems worth putting in.

Reviewed By: @edwinsmith

Differential Revision: D1690835

Signature: t1:1690835:1416415333:1060c99a6e41c5ea9380d981e5bcc60d03ba62ce
Add a dataflow_worklist class to use instead of some std::sets

Reviewed By: @edwinsmith

Differential Revision: D1690949

Signature: t1:1690949:1416418755:8d90adcc22f60684de46797112b9cf36c519463e
Load elimination pass

Summary: This is still kinda a work in progress and doesn't do very much yet,
but it can eliminate some loads in trivial situations.  I think it's landable
and we can iterate more in trunk.  (Teaching memory-effects more and doing
things like getting DecRefs that can re-enter out of the main lines of code may
make it more effective even without more improvements here, too.)

Reviewed By: @ottoni

Differential Revision: D1691662
Rename memelim to store-elim for now

Reviewed By: @alexmalyshev

Differential Revision: D1691700

Signature: t1:1691700:1416430962:326925bd916f0c3dfff35034a3099c685b936215
Revert "Revert "Add fixed-point analysis to FrameState""

Summary: This reverts commit 532e6ca9ce3aa88e8e006024ce4b76b25b8ab6a8, and
turns the fixed point stuff on only if EvalHHIRBytecodeControlFlow is true
(which will have refcountOptsDefault saying false).

Reviewed By: @alexmalyshev

Differential Revision: D1691934

Signature: t1:1691934:1416434945:8acd6b40f5d08e8b8d7575048135e5a960f28e33
Use dataflow_worklist in FrameState fixed point loop

Reviewed By: @edwinsmith

Differential Revision: D1691948

Signature: t1:1691948:1416503211:d4375963841abfe3ab74f9704b16586881e0d176
Some FrameState refactoring and bug fixes

Summary: Turn all the states into vectors, with the most current version being
the back().  This makes it easier to merge states for inlined calls and also
simplifies various snapshotting code (assignment operators).  Also it gets rid
of the weird thing where the Snapshot structure had a sometimes-valid
inlineSavedStates field.  This diff fixes the potential bugs from things like
refineLocalValue when you're in an inlined function with control flow, and
fixes a bug in the fixed point version of frame-state where frameSpansCall
could randomly be set to true depending on which block you were previously
visiting.

This is an intermediate refactor, so things like the name 'Snapshot' will go
away on a later diff.

Reviewed By: @bertmaher

Differential Revision: D1695209
Rename FrameState to FrameStateMgr

Summary: I don't think we need this class at all, but for now it's too
intertwined with everything to remove.  I want to s/Snapshot/FrameState/, so
call this FrameStateMgr: it really manages FrameStates for multiple blocks (in
addition to understanding how to track effects and manage CSE table state).

Reviewed By: @ottoni

Differential Revision: D1695214

Signature: t1:1695214:1416594843:e2fb6e9dd1d4310d03ef6d1f277ca4872c7de83f
Rename Snapshot to FrameState

Summary: The thing formerly known as Snapshot is the state for a given frame
now.

Reviewed By: @ottoni

Differential Revision: D1695220

Signature: t1:1695220:1416594762:abc3b8a03cee7137d34f2a45ea432a0613725de8