Title: [241176] trunk/Source/_javascript_Core
Revision
241176
Author
rmoris...@apple.com
Date
2019-02-07 17:01:38 -0800 (Thu, 07 Feb 2019)

Log Message

Fix Abs(Neg(x)) -> Abs(x) optimization in B3ReduceStrength
https://bugs.webkit.org/show_bug.cgi?id=194420

Reviewed by Saam Barati.

In https://bugs.webkit.org/show_bug.cgi?id=194250, I added an optimization: Abs(Neg(x)) -> Abs(x).
But I introduced two bugs, one is that I actually implemented Abs(Neg(x)) -> x, and the other is that the test is looking at Abs(Abs(x)) instead (both were stupid copy-paste mistakes).
This trivial patch fixes both.

* b3/B3ReduceStrength.cpp:
* b3/testb3.cpp:
(JSC::B3::testAbsNegArg):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (241175 => 241176)


--- trunk/Source/_javascript_Core/ChangeLog	2019-02-08 01:01:15 UTC (rev 241175)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-02-08 01:01:38 UTC (rev 241176)
@@ -1,3 +1,18 @@
+2019-02-07  Robin Morisset  <rmoris...@apple.com>
+
+        Fix Abs(Neg(x)) -> Abs(x) optimization in B3ReduceStrength
+        https://bugs.webkit.org/show_bug.cgi?id=194420
+
+        Reviewed by Saam Barati.
+
+        In https://bugs.webkit.org/show_bug.cgi?id=194250, I added an optimization: Abs(Neg(x)) -> Abs(x).
+        But I introduced two bugs, one is that I actually implemented Abs(Neg(x)) -> x, and the other is that the test is looking at Abs(Abs(x)) instead (both were stupid copy-paste mistakes).
+        This trivial patch fixes both.
+
+        * b3/B3ReduceStrength.cpp:
+        * b3/testb3.cpp:
+        (JSC::B3::testAbsNegArg):
+
 2019-02-07  Keith Miller  <keith_mil...@apple.com>
 
         Better error messages for module loader SPI

Modified: trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp (241175 => 241176)


--- trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp	2019-02-08 01:01:15 UTC (rev 241175)
+++ trunk/Source/_javascript_Core/b3/B3ReduceStrength.cpp	2019-02-08 01:01:38 UTC (rev 241176)
@@ -1241,7 +1241,8 @@
             // Turn this: Abs(Neg(value))
             // Into this: Abs(value)
             if (m_value->child(0)->opcode() == Neg) {
-                replaceWithIdentity(m_value->child(0)->child(0));
+                m_value->child(0) = m_value->child(0)->child(0);
+                m_changed = true;
                 break;
             }
 

Modified: trunk/Source/_javascript_Core/b3/testb3.cpp (241175 => 241176)


--- trunk/Source/_javascript_Core/b3/testb3.cpp	2019-02-08 01:01:15 UTC (rev 241175)
+++ trunk/Source/_javascript_Core/b3/testb3.cpp	2019-02-08 01:01:38 UTC (rev 241176)
@@ -3984,7 +3984,7 @@
 {
     Procedure proc;
     BasicBlock* root = proc.addBlock();
-    Value* neg = root->appendNew<Value>(proc, Abs, Origin(),
+    Value* neg = root->appendNew<Value>(proc, Neg, Origin(),
         root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0));
     Value* abs = root->appendNew<Value>(proc, Abs, Origin(), neg);
     root->appendNewControlValue(proc, Return, Origin(), abs);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to