Bug 1062612 - IonMonkey: Fix cast insertion for truncation of phi operands r=nbp

This commit is contained in:
Dan Gohman 2014-09-04 08:04:34 -07:00
parent 9a81e7b11f
commit 94927c5089
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,7 @@
x = [0, 1, 1, 0, 1, 1];
y = -1;
sum = 0;
for (var j = 0; j < x.length; ++j) {
sum = sum + (x[j] ? 0 : (y >>> 0)) | 0;
}
assertEq(sum, -2);

View File

@ -2582,7 +2582,7 @@ AdjustTruncatedInputs(TempAllocator &alloc, MDefinition *truncated)
op = MTruncateToInt32::New(alloc, truncated->getOperand(i));
if (truncated->isPhi()) {
MBasicBlock *pred = op->block()->getPredecessor(i);
MBasicBlock *pred = block->getPredecessor(i);
pred->insertBefore(pred->lastIns(), op);
} else {
block->insertBefore(truncated->toInstruction(), op);