RESOLVED FIXED Bug 196371
B3 should reduce (integer) Sub(Neg(x), y) to Neg(Add(x, y))
https://bugs.webkit.org/show_bug.cgi?id=196371
Summary B3 should reduce (integer) Sub(Neg(x), y) to Neg(Add(x, y))
Robin Morisset
Reported 2019-03-28 12:46:08 PDT
It does not reduce the number of operation, but is a useful canonicalization in a few ways: - improves the chance for CSE to work - floating the Neg outwards maximizes the chance it will get eliminated - it is generally easier to optimize Add (which is associative on integers) than Sub.
Attachments
Patch (7.81 KB, patch)
2019-07-11 20:11 PDT, Justin Michaud
no flags
Robin Morisset
Comment 1 2019-06-27 11:22:18 PDT
Other similar reduction rules that would be useful (look at https://bugs.webkit.org/show_bug.cgi?id=199203 for an example where rules 1 and 3 would allow a lot of simplifications): Sub(Sub(a, b), c) => Sub(a, Add(b, c)) Sub(a, Sub(b, c)) => Sub(Add(a, c), b) Sub(Add(a, b), c) => Add(a, Sub(b, c))
Justin Michaud
Comment 2 2019-07-11 20:11:57 PDT
Keith Miller
Comment 3 2019-07-11 20:19:20 PDT
Comment on attachment 373995 [details] Patch r=me.
WebKit Commit Bot
Comment 4 2019-07-12 10:11:37 PDT
Comment on attachment 373995 [details] Patch Clearing flags on attachment: 373995 Committed r247390: <https://trac.webkit.org/changeset/247390>
WebKit Commit Bot
Comment 5 2019-07-12 10:11:38 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 6 2019-07-12 10:14:04 PDT
Note You need to log in before you can comment on or make changes to this bug.