-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix opt/shrink levels when running the optimizer multiple times, Part…
… 2 (#5787) This is a followup to #5333 . That fixed the selection of which passes to run, but forgot to also fix the global state of the current optimize/shrink levels. This PR fixes that. As a result, running -O3 -Oz will now work as expected: the first -O3 will run the right passes (as #5333 fixed) and while running them, the global optimize/shrinkLevels will be -O3 (and not -Oz), which this PR fixes. A specific result of this is that -O3 -Oz used to inline less, since the invocation of inlining during -O3 thought we were optimizing for size. The new test verifies that we do fully inline in the first -O3 now.
- Loading branch information
Showing
6 changed files
with
92 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. | ||
|
||
;; RUN: foreach %s %t wasm-opt -O3 -Oz -S -o - | filecheck %s | ||
|
||
(module | ||
(func $inline.me (param $x i32) (result i32) | ||
(i32.add | ||
(local.get $x) | ||
(i32.const 2) | ||
) | ||
) | ||
|
||
(func "export" (param $x i32) (result i32) | ||
;; $inline.me is called twice, so we do not always inline it like called- | ||
;; once functions are. -Oz is too cautious to inline such things that may | ||
;; end up increasing total code size, but we are running -O3 -Oz here and so | ||
;; the first -O3 will inline there. That is, this test verifies that the | ||
;; later -Oz does not affect the earlier -O3 (which it could, if -Oz set | ||
;; global state that -O3 then reads to see the optimization and shrink | ||
;; levels). | ||
(i32.add | ||
(call $inline.me | ||
(local.get $x) | ||
) | ||
(call $inline.me | ||
(local.get $x) | ||
) | ||
) | ||
) | ||
) | ||
;; CHECK: (type $i32_=>_i32 (func (param i32) (result i32))) | ||
|
||
;; CHECK: (export "export" (func $1)) | ||
|
||
;; CHECK: (func $1 (; has Stack IR ;) (param $0 i32) (result i32) | ||
;; CHECK-NEXT: (i32.add | ||
;; CHECK-NEXT: (local.tee $0 | ||
;; CHECK-NEXT: (i32.add | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: (i32.const 2) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (local.get $0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) |
This file was deleted.
Oops, something went wrong.