Fix more GVN issues (#83)

* Fix GVN skipping the instruction after a deleted instruction.

* Teach GVN to resolve aliases as it proceeds.

* Clean up an obsolete reference to extended_values.
This commit is contained in:
Dan Gohman
2017-05-25 16:37:31 -07:00
committed by GitHub
parent dc809628f4
commit 059845880c
4 changed files with 59 additions and 14 deletions

View File

@@ -4,8 +4,18 @@ function simple_redundancy(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = iadd v0, v1
v3 = iadd v0, v1
; check: v3 -> v2
v4 = imul v2, v3
; check: v4 = imul $v2, $v3
; check: v4 = imul $v2, $v2
return v4
}
function cascading_redundancy(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = iadd v0, v1
v3 = iadd v0, v1
v4 = imul v2, v3
v5 = imul v2, v2
v6 = iadd v4, v5
; check: v6 = iadd $v4, $v4
return v6
}