summaryrefslogtreecommitdiff
path: root/src/passes/OptimizeForJS.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [OptimizeForJS] Fix use of localized variable in popcnt(x) == 1 rule (#4057)Max Graey2021-08-051-3/+1
| | | | Localizer may have added a new tee and a local, and we should apply the tee in the right place.
* [OptimizeForJS] Refactor rewritePopcntEqualOne (#4050)Max Graey2021-08-031-26/+8
|
* [JS] Add a new OptimizeForJS pass (#4033)Max Graey2021-08-021-0/+92
Add a new OptimizeForJS pass which contains rewriting rules specific to JavaScript. LLVM usually lowers x != 0 && (x & (x - 1)) == 0 (isPowerOf2) to popcnt(x) == 1 which is ok for wasm and other targets but is quite expensive for JavaScript. In this PR we lower the popcnt pattern back to the isPowerOf2 pattern.