From f35f02c1ce1b3129aa83d2dddeababd414c1ca8f Mon Sep 17 00:00:00 2001 From: Max Graey Date: Mon, 2 Aug 2021 16:30:26 +0300 Subject: [JS] Add a new OptimizeForJS pass (#4033) 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. --- test/lit/help/optimization-opts.test | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/lit/help/optimization-opts.test') diff --git a/test/lit/help/optimization-opts.test b/test/lit/help/optimization-opts.test index 0d4ed48a8..c6d45332d 100644 --- a/test/lit/help/optimization-opts.test +++ b/test/lit/help/optimization-opts.test @@ -347,6 +347,9 @@ ;; CHECK-NEXT: load/store offsets, propagating ;; CHECK-NEXT: them across locals too ;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-for-js early optimize of the +;; CHECK-NEXT: instruction combinations for js +;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-instructions optimizes instruction ;; CHECK-NEXT: combinations ;; CHECK-NEXT: -- cgit v1.2.3