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
Rework frame state merging not to copy construct states as much

Summary: Make merge_into overloads for various sub-portions of the state, and
have all of them return bools to indicate if anything changed.

Reviewed By: @alexmalyshev

Differential Revision: D1695223

Signature: t1:1695223:1416614176:a4e7f79bc78a19cb1cf428e3054db3b94c083332
Move CSE-related code out of FrameStateMgr

Summary: IRBuilder is not a good final place for it either, but this gets it
out of the way of some of the frame state stuff for now.  It's apparently
semi-broken during reoptimize (whether it finds values or not depends on the
block visitation order; e.g. you may cseKill values on some paths that you
don't really need to just because you visited blocks in an order that saw
killing-paths first).  I think LdCtx is the only important thing we CSE right
now though, and it'll always be available now.

Reviewed By: @alexmalyshev

Differential Revision: D1695435

Signature: t1:1695435:1416613090:df2fc292516bb651d67f4c5c2e990feb028829cd
Make inlineIdx in walkAllInlinedLocals-related callbacks just an index

Summary: It had a pretty unusual encoding scheme, which must have some
historical reason.  At first I thought it was a bug, but there's only one use
site and it expected this.

Reviewed By: @ottoni

Differential Revision: D1695489

Signature: t1:1695489:1416595757:eefbfdbe25a4606613d2ea34437805f9377aec97
Don't track incorrect types for locals in psuedomains

Summary: Right now we have localType() returning things that aren't known to be
true in psuedomains.  Rather than audit all callers (which will still let bugs
creep in later), let's generalize the predicted inner type for boxes to a
general predicted type, and use it for the only real type we track for locals
in psuedomains.  Use this to decide what to guard on when we want to emit a
LdLocPseudoMain.

This also fixes a bug where we were doing StLoc in psuedomains in the Silence
opcode (needs to be illegal because it'll set a tracked local value right now).

Reviewed By: @alexmalyshev

Differential Revision: D1696464
Rename ALocation to AliasClass, ALocationAnalysis to AliasAnalysis

Summary: No one seemed to like the old name.  A few places really still seem to
make sense to call things "locations" (in AliasAnalysis's lists of tracked
locations---they are alias classes but small enough to at least possibly be
"one" location), so there are some "locations" here and there still.  I guess
"(abstract) mem locations : AliasClass :: values : Type" is the analogy.

Reviewed By: @edwinsmith

Differential Revision: D1696691