From ec376688e914c26bd2f4030f9563f288cdcf5c33 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Mon, 10 Jul 2017 07:38:48 -0700 Subject: [PATCH] Handle Assert{Loc,Stk} better in load-elim Summary: If we're tracking the value of a location at the point of an AssertLoc/Stk, we'll convert it to an AssertType on the value. But if we have a single-valued type (eg Uninit, or 42), we wouldn't. Fix it to update in those cases too. Reviewed By: mxw Differential Revision: D5384914 fbshipit-source-id: d5df54be60f8625e7a734e3b1afb367606c51dc7 --- hphp/runtime/vm/jit/load-elim.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hphp/runtime/vm/jit/load-elim.cpp b/hphp/runtime/vm/jit/load-elim.cpp index 61db17ee4dd..da2c73ea851 100644 --- a/hphp/runtime/vm/jit/load-elim.cpp +++ b/hphp/runtime/vm/jit/load-elim.cpp @@ -595,13 +595,22 @@ Flags handle_assert(Local& env, const IRInstruction& inst) { auto const meta = env.global.ainfo.find(canonicalize(*acls)); auto const tloc = find_tracked(env, meta); - if (!tloc) return FNone{}; + if (!tloc) { + FTRACE(4, " untracked assert\n"); + return FNone{}; + } tloc->knownType &= inst.typeParam(); - if (tloc->knownValue != nullptr) { + if (tloc->knownValue != nullptr || tloc->knownType.admitsSingleVal()) { + if (tloc->knownValue == nullptr) { + tloc->knownValue = env.global.unit.cns(tloc->knownType); + } + + FTRACE(4, " reducible assert: {}\n", show(*tloc)); return FReducible { tloc->knownValue, tloc->knownType, meta->index }; } + FTRACE(4, " non-reducible assert: {}\n", show(*tloc)); return FNone{}; } @@ -847,7 +856,7 @@ void reduce_inst(Global& env, IRInstruction& inst, const FReducible& flags) { default: always_assert(false); } - FTRACE(2, " reducible: {} = {} {}\n", + FTRACE(2, " reduced: {} = {} {}\n", opcodeName(oldOp), opcodeName(newOp), resolved->toString()); -- 2.11.4.GIT