Bug 1716231: Clean up float32 handling in GuessPhiType r=jandem

Differential Revision: https://phabricator.services.mozilla.com/D117699
This commit is contained in:
Iain Ireland 2021-06-15 16:19:47 +00:00
parent 05483e35f8
commit b71c0650a5
2 changed files with 34 additions and 8 deletions

View File

@ -0,0 +1,25 @@
// |jit-test| --fast-warmup; --ion-offthread-compile=off
const too_big_for_float32 = 67109020;
function call_with_no_ic_data() {}
function foo() {
call_with_no_ic_data();
let x = too_big_for_float32;
let result;
// We OSR in this loop.
for (let i = 0; i < 100; i++) {
const float32 = Math.fround(0);
// Create a phi with one float32-typed input
// and one OSRValue input.
result = float32 || x;
}
return result;
}
assertEq(foo(), too_big_for_float32);

View File

@ -1460,6 +1460,7 @@ MIRType TypeAnalyzer::guessPhiType(MPhi* phi) const {
MIRType type = MIRType::None;
bool convertibleToFloat32 = false;
bool hasOSRValueInput = false;
DebugOnly<bool> hasSpecializableInput = false;
for (size_t i = 0, e = phi->numOperands(); i < e; i++) {
MDefinition* in = phi->getOperand(i);
@ -1479,15 +1480,8 @@ MIRType TypeAnalyzer::guessPhiType(MPhi* phi) const {
// See shouldSpecializeOsrPhis comment. This is the first step mentioned
// there.
if (shouldSpecializeOsrPhis() && in->isOsrValue()) {
hasOSRValueInput = true;
hasSpecializableInput = true;
// TODO(post-Warp): simplify float32 handling in this function or (better)
// make the float32 analysis a stand-alone optimization pass instead of
// complicating type analysis. See bug 1655773.
convertibleToFloat32 = false;
if (type == MIRType::Float32) {
type = MIRType::Double;
}
continue;
}
@ -1518,6 +1512,13 @@ MIRType TypeAnalyzer::guessPhiType(MPhi* phi) const {
}
}
if (hasOSRValueInput && type == MIRType::Float32) {
// TODO(post-Warp): simplify float32 handling in this function or (better)
// make the float32 analysis a stand-alone optimization pass instead of
// complicating type analysis. See bug 1655773.
type = MIRType::Double;
}
MOZ_ASSERT_IF(type == MIRType::None, hasSpecializableInput);
return type;
}