mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1716231: Clean up float32 handling in GuessPhiType r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D117699
This commit is contained in:
parent
05483e35f8
commit
b71c0650a5
25
js/src/jit-test/tests/warp/bug1716231.js
Normal file
25
js/src/jit-test/tests/warp/bug1716231.js
Normal 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);
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user