Don't perform gvn on instructions with other_side_effects().
This commit is contained in:
11
cranelift/filetests/simple_gvn/reject.cton
Normal file
11
cranelift/filetests/simple_gvn/reject.cton
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
test simple-gvn
|
||||||
|
|
||||||
|
function %other_side_effects(i32) -> i32 {
|
||||||
|
ebb0(v0: i32):
|
||||||
|
regmove v0, %10 -> %20
|
||||||
|
regmove v0, %10 -> %20
|
||||||
|
regmove v0, %20 -> %10
|
||||||
|
; check: regmove v0, %10 -> %20
|
||||||
|
; check: regmove v0, %10 -> %20
|
||||||
|
return v0
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ use std::collections::HashMap;
|
|||||||
/// Test whether the given opcode is unsafe to even consider for GVN.
|
/// Test whether the given opcode is unsafe to even consider for GVN.
|
||||||
fn trivially_unsafe_for_gvn(opcode: Opcode) -> bool {
|
fn trivially_unsafe_for_gvn(opcode: Opcode) -> bool {
|
||||||
opcode.is_call() || opcode.is_branch() || opcode.is_terminator() || opcode.is_return() ||
|
opcode.is_call() || opcode.is_branch() || opcode.is_terminator() || opcode.is_return() ||
|
||||||
opcode.can_trap()
|
opcode.can_trap() || opcode.other_side_effects()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Perform simple GVN on `func`.
|
/// Perform simple GVN on `func`.
|
||||||
|
|||||||
Reference in New Issue
Block a user