12018-03-11 Yusuke Suzuki <utatane.tea@gmail.com>
2
3 [B3] Above/Below should be strength-reduced for comparison with 0
4 https://bugs.webkit.org/show_bug.cgi?id=183543
5
6 Reviewed by NOBODY (OOPS!).
7
8 Above(0, x) and BelowEqual(0, x) can be converted to constants false and true respectively.
9 This can be seen in ArraySlice(0) case: `Select(Above(0, length), length, 0)` this should
10 be converted to `0`. This patch adds such a folding to comparisons.
11
12 We also fix B3ReduceStrength issue creating an orphan value. This issue causes JSC test failure
13 with this B3Const32/64Value change. We carefully change the opcode of m_value to fix this issue.
14
15 * b3/B3Const32Value.cpp:
16 (JSC::B3::Const32Value::lessThanConstant const):
17 (JSC::B3::Const32Value::greaterThanConstant const):
18 (JSC::B3::Const32Value::lessEqualConstant const):
19 (JSC::B3::Const32Value::greaterEqualConstant const):
20 (JSC::B3::Const32Value::aboveConstant const):
21 (JSC::B3::Const32Value::belowConstant const):
22 (JSC::B3::Const32Value::aboveEqualConstant const):
23 (JSC::B3::Const32Value::belowEqualConstant const):
24 * b3/B3Const64Value.cpp:
25 (JSC::B3::Const64Value::lessThanConstant const):
26 (JSC::B3::Const64Value::greaterThanConstant const):
27 (JSC::B3::Const64Value::lessEqualConstant const):
28 (JSC::B3::Const64Value::greaterEqualConstant const):
29 (JSC::B3::Const64Value::aboveConstant const):
30 (JSC::B3::Const64Value::belowConstant const):
31 (JSC::B3::Const64Value::aboveEqualConstant const):
32 (JSC::B3::Const64Value::belowEqualConstant const):
33 * b3/B3ReduceStrength.cpp:
34 * b3/testb3.cpp:
35 (JSC::B3::int64Operands):
36 (JSC::B3::int32Operands):
37