Bug 1085298 - IonMonkey: Fix for when folding ternary constructs and a branch dominates both MPhi predecessors, r=nbp

This commit is contained in:
Hannes Verschore 2014-10-23 15:34:13 +02:00
Родитель d09b5b8702
Коммит e69262b1cf
2 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,7 @@
function f(x, y) {
return (y | 0 && x ? y | 0 : 0)
}
m = [1]
assertEq(f(m[0], m[0]), 1)
assertEq(f(m[1], m[0]), 0)
assertEq(f(m[2], m[0]), 0)

Просмотреть файл

@ -1265,14 +1265,14 @@ MPhi::foldsTernary()
MTest *test = pred->lastIns()->toTest();
// True branch may only dominate one edge of MPhi.
if (test->ifTrue()->dominates(block()->getPredecessor(0)) &&
if (test->ifTrue()->dominates(block()->getPredecessor(0)) ==
test->ifTrue()->dominates(block()->getPredecessor(1)))
{
return nullptr;
}
// False branch may only dominate one edge of MPhi.
if (test->ifFalse()->dominates(block()->getPredecessor(0)) &&
if (test->ifFalse()->dominates(block()->getPredecessor(0)) ==
test->ifFalse()->dominates(block()->getPredecessor(1)))
{
return nullptr;