From c489379fca00630badc4019318c666d5d43ed6a5 Mon Sep 17 00:00:00 2001 From: mwilliams Date: Mon, 18 Mar 2013 10:06:19 -0700 Subject: [PATCH] Most constructors return null So annotate the PopR to avoid generating code. --- hphp/compiler/analysis/emitter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hphp/compiler/analysis/emitter.cpp b/hphp/compiler/analysis/emitter.cpp index 245ea70d9..67c9b51b5 100644 --- a/hphp/compiler/analysis/emitter.cpp +++ b/hphp/compiler/analysis/emitter.cpp @@ -3382,6 +3382,13 @@ bool EmitterVisitor::visitImpl(ConstructPtr node) { } e.FCall(numParams); + if (Option::WholeProgram) { + FunctionScopePtr fs = ne->getFuncScope(); + if (fs && !fs->getReturnType()) { + m_evalStack.setKnownType(KindOfNull, false /* inferred */); + m_evalStack.setNotRef(); + } + } e.PopR(); return true; }