Files
wasmtime/cranelift/filetests/simple_gvn/readonly.clif
Lachlan Sneff 586a8835e9 Add a readonly flag for loads (#562)
* Add readonly MemFlag

* Add readonly flag verifier check

* Make global loads readonly

* Fix gvn to consider readonly loads
2018-10-22 21:50:09 -07:00

26 lines
631 B
Plaintext

test simple-gvn
target x86_64
function %eliminate_redundant_global_loads(i32, i64 vmctx) {
gv0 = vmctx
gv1 = load.i64 notrap aligned readonly gv0
heap0 = static gv1, min 0x1_0000, bound 0x1_0000_0000, guard 0x8000_0000, index_type i32
ebb0(v0: i32, v1: i64):
v2 = heap_addr.i64 heap0, v0, 1
v3 = heap_addr.i64 heap0, v0, 1
v4 = iconst.i32 0
store.i32 notrap aligned v4, v2
store.i32 notrap aligned v4, v3
return
}
; check: v2 = heap_addr.i64 heap0, v0, 1
; check: v3 -> v2
; check: v4 = iconst.i32 0
; check: store notrap aligned v4, v2
; check: store notrap aligned v4, v2
; check: return