Fix a bug in simplifyDecRefStack

My bad.  If you're going to gen something with no dest in
simplifier, you need to nop out the old one.  This was leading to
over-decrefs in some cases.
Esse commit está contido em:
Jordan DeLong
2013-05-18 10:22:06 -07:00
commit de Sara Golemon
commit a9da324254
24 arquivos alterados com 46 adições e 3 exclusões
@@ -1688,6 +1688,7 @@ SSATmp* Simplifier::simplifyDecRefStack(IRInstruction* inst) {
auto const info = getStackValue(inst->getSrc(0),
inst->getExtra<StackOffset>()->offset);
if (info.value && !info.spansCall) {
inst->convertToNop();
return gen(DecRef, info.knownType, info.value);
}
if (!info.knownType.equals(Type::None)) {
@@ -915,6 +915,9 @@ void CSEHash::filter(Block* block, IdomVector& idoms) {
* fall-through edge to the next block.
*/
void TraceBuilder::reoptimize() {
FTRACE(5, "ReOptimize:vvvvvvvvvvvvvvvvvvvv\n");
SCOPE_EXIT { FTRACE(5, "ReOptimize:^^^^^^^^^^^^^^^^^^^^\n"); };
m_enableCse = RuntimeOption::EvalHHIRCse;
m_enableSimplification = RuntimeOption::EvalHHIRSimplification;
if (!m_enableCse && !m_enableSimplification) return;
@@ -924,25 +927,31 @@ void TraceBuilder::reoptimize() {
// t2135219 should address that
return;
}
BlockList sortedBlocks = sortCfg(m_trace.get(), m_irFactory);
IdomVector idoms = findDominators(sortedBlocks);
clearTrackedState();
auto blocks = std::move(m_trace->getBlocks());
assert(m_trace->getBlocks().empty());
while (!blocks.empty()) {
Block* block = blocks.front();
blocks.pop_front();
assert(block->getTrace() == m_trace.get());
FTRACE(5, "Block: {}\n", block->postId());
m_trace->push_back(block);
if (m_snapshots[block]) {
useState(block);
m_cseHash.filter(block, idoms);
}
auto instructions = std::move(block->getInstrs());
assert(block->empty());
while (!instructions.empty()) {
auto *inst = &instructions.front();
instructions.pop_front();
SSATmp* tmp = optimizeWork(inst); // Can generate new instrs!
if (!tmp) {
// Could not optimize; keep the old instruction
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
@@ -1 +1 @@
../hiphop.opts
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1 -1
Ver Arquivo
@@ -1 +1 @@
../hiphop.opts
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
-vEval.JitEnableRenameFunction=0 -vEval.EnableHipHopSyntax=1
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+15
Ver Arquivo
@@ -0,0 +1,15 @@
<?php
class Obj {
public function __construct() {
$this->uniqueVar = "a string";
}
private $uniqueVar;
}
function test() {
new Obj();
echo "done\n";
}
test();
@@ -0,0 +1 @@
done
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1 -1
Ver Arquivo
@@ -1 +1 @@
../hiphop.opts
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts
+1
Ver Arquivo
@@ -0,0 +1 @@
inlining.opts