forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When we're trying to delete block-params that can be replaced by a single dominating value, we weren't handling some cases. In particular, if we concluded that a block formal parameter (say, `v3`) had more than one value, then we believed that any uses of that parameter (say, defining another formal parameter `v4`) also had more than one value, and therefore could not be deleted. However, in such cases we can try using `v3` itself as the definition of `v4`. If there are no other definitions of `v4`, then it can be deleted. With this change, if a block has only one predecessor, it is now true that this pass will delete all of its block params. We couldn't rely on that property before.
- Loading branch information
1 parent
81a8916
commit 27c1c1d
Showing
2 changed files
with
73 additions
and
41 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
33 changes: 33 additions & 0 deletions
33
cranelift/filetests/filetests/remove-constant-phis/maximal.clif
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,33 @@ | ||
test optimize precise-output | ||
target x86_64 | ||
|
||
function u0:0(i32, i32, i32) -> i32 { | ||
block0(v0: i32, v1: i32, v2: i32): | ||
brif v0, block1(v1), block1(v2) | ||
|
||
block1(v3: i32): | ||
brif v0, block3(v3), block2(v3) | ||
|
||
block2(v4: i32): | ||
jump block3(v4) | ||
|
||
block3(v5: i32): | ||
return v5 | ||
} | ||
|
||
; function u0:0(i32, i32, i32) -> i32 fast { | ||
; block0(v0: i32, v1: i32, v2: i32): | ||
; brif v0, block1(v1), block1(v2) | ||
; | ||
; block1(v3: i32): | ||
; v4 -> v3 | ||
; v5 -> v3 | ||
; brif.i32 v0, block3, block2 | ||
; | ||
; block2: | ||
; jump block3 | ||
; | ||
; block3: | ||
; return v5 | ||
; } | ||
|