Skip to content

Commit dc2b440

Browse files
author
Meghana Gupta
committed
OS#15997192: Disable strict valuetype assert for hoistable syms
The assert says that for a hoistable value, if its valuetype is primitive in the loop landing pad, it should be atleast LikelyPrimitive inside the loop. This assert does not hold true in a few cases when we force specialize syms in the loop landing pad. Ex : landingPad: a = v1; b = v1; loop : b = v2; // forces float conversion in landing pad c = a; jump loop During force specializing in loop landing pad of b, both a and b have the same valueinfo, so they transition to a DefiniteFloat. This takes b to definite float in the loop landing pad but not inside the loop. We do not have a way to force Specialize a in the loop, we cannot assume force specializing b again in the loop will update the valueInfo of a, because they may have different value numbers in the loop. Since we don't have a way to lookup values by valueNumber, there is no easy way to fix this gap currently. Added test to keep track of this gap.
1 parent 6127540 commit dc2b440

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

lib/Backend/GlobOpt.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14323,10 +14323,8 @@ GlobOpt::OptIsInvariant(Sym *sym, BasicBlock *block, Loop *loop, Value *srcVal,
1432314323
return false;
1432414324
}
1432514325

14326-
// If the loopHeadVal is primitive, the current value should be as well. This really should be
14327-
// srcVal->GetValueInfo()->IsPrimitive() instead of IsLikelyPrimitive, but this stronger assertion
14328-
// doesn't hold in some cases when this method is called out of the array code.
14329-
Assert((!loopHeadVal->GetValueInfo()->IsPrimitive()) || srcVal->GetValueInfo()->IsLikelyPrimitive());
14326+
// Disabling this assert, because it does not hold true when we force specialize in the loop landing pad
14327+
//Assert((!loopHeadVal->GetValueInfo()->IsPrimitive()) || srcVal->GetValueInfo()->IsLikelyPrimitive());
1433014328

1433114329
return true;
1433214330
}

test/Optimizer/rlexe.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,4 +1568,10 @@
15681568
<compile-flags>-maxinterpretcount:1 -maxsimplejitruncount:1 -off:aggressiveinttypespec</compile-flags>
15691569
</default>
15701570
</test>
1571+
<test>
1572+
<default>
1573+
<files>valuetypegap.js</files>
1574+
<compile-flags>-maxinterpretcount:1 -maxsimplejitruncount:1 -force:inline</compile-flags>
1575+
</default>
1576+
</test>
15711577
</regress-exe>

test/Optimizer/valuetypegap.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
function test0() {
7+
function leaf() {
8+
}
9+
(function (argMath6, argMath7) {
10+
do {
11+
}
12+
while (argMath6 * (argMath7 /= test0));
13+
}(leaf, leaf));
14+
}
15+
16+
test0();
17+
test0();
18+
test0();
19+
test0();
20+
print("Passed\n");

0 commit comments

Comments
 (0)