Bug 1207449: Conservatively mark MFilterTypeSet with phis as not float32-compatible; r=h4writer

This commit is contained in:
Benjamin Bouvier 2015-09-23 19:43:00 +02:00
parent b24b59bb6c
commit 817cda4607
3 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,6 @@
function f(x) {
return Math.fround((x ? 0 : x) | Math.max(x, x));
}
for (var j = 0; j < 2; ++j) {
assertEq(f((function(){}) - 4294967297 ? 1 : 1 | 0 && 4294967297), 1);
}

View File

@ -2394,11 +2394,26 @@ MFilterTypeSet::trySpecializeFloat32(TempAllocator& alloc)
setResultType(MIRType_Float32);
}
bool
MFilterTypeSet::canProduceFloat32() const
{
// A FilterTypeSet should be a producer if the input is a producer too.
// Also, be overly conservative by marking as not float32 producer when the
// input is a phi, as phis can be cyclic (phiA -> FilterTypeSet -> phiB ->
// phiA) and FilterTypeSet doesn't belong in the Float32 phi analysis.
return !input()->isPhi() && input()->canProduceFloat32();
}
bool
MFilterTypeSet::canConsumeFloat32(MUse* operand) const
{
MOZ_ASSERT(getUseFor(0) == operand);
return CheckUsesAreFloat32Consumers(this);
// A FilterTypeSet should be a consumer if all uses are consumer. See also
// comment below MFilterTypeSet::canProduceFloat32.
bool allConsumerUses = true;
for (MUseDefIterator use(this); allConsumerUses && use; use++)
allConsumerUses &= !use.def()->isPhi() && use.def()->canConsumeFloat32(use.use());
return allConsumerUses;
}
void

View File

@ -12371,7 +12371,7 @@ class MFilterTypeSet
void computeRange(TempAllocator& alloc) override;
bool isFloat32Commutative() const override { return true; }
bool canProduceFloat32() const override { return input()->canProduceFloat32(); }
bool canProduceFloat32() const override;
bool canConsumeFloat32(MUse* operand) const override;
void trySpecializeFloat32(TempAllocator& alloc) override;
};