-
Notifications
You must be signed in to change notification settings - Fork 839
Handle constant offsets larger than 4G in memory64-lowering #8316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a3f3e9a
257238d
4719f9b
ad91ad8
df38cbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -440,3 +440,137 @@ | |
| (table.init $t64 $elem64 (i64.const 0) (i32.const 5) (i32.const 10)) | ||
| ) | ||
| ) | ||
|
|
||
| (module | ||
| (memory i64 1 1) | ||
|
|
||
| ;; CHECK: (type $0 (func (param i64 v128))) | ||
|
|
||
| ;; CHECK: (type $1 (func (param i64) (result i32))) | ||
|
|
||
| ;; CHECK: (type $2 (func (param i64 i32))) | ||
|
|
||
| ;; CHECK: (type $3 (func (param i64))) | ||
|
|
||
| ;; CHECK: (memory $0 1 1) | ||
|
|
||
| ;; CHECK: (func $test_large_offsets (param $ptr i64) (result i32) | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_large_offsets (param $ptr i64) (result i32) | ||
| (i32.load offset=4294967297 (local.get $ptr)) | ||
| ) | ||
|
|
||
| ;; CHECK: (func $test_store_large_offset (param $ptr i64) (param $val i32) | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_store_large_offset (param $ptr i64) (param $val i32) | ||
| (i32.store offset=4294967296 (local.get $ptr) (local.get $val)) | ||
| ) | ||
|
|
||
| ;; CHECK: (func $test_simd_load_large_offset (param $ptr i64) | ||
| ;; CHECK-NEXT: (drop | ||
| ;; CHECK-NEXT: (block | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_simd_load_large_offset (param $ptr i64) | ||
| (drop (v128.load offset=4294967296 (local.get $ptr))) | ||
| ) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I turn on pass debug I'm getting a validation error: I guess I need to propagate the unreachable type from the block up to the drop? Is there a utility for that?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, yes, if you add an unreachable that is a type change. You can note that and then run
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, does this look right?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, lgtm |
||
|
|
||
| ;; CHECK: (func $test_simd_load_lane_large_offset (param $ptr i64) (param $val v128) | ||
| ;; CHECK-NEXT: (drop | ||
| ;; CHECK-NEXT: (block | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_simd_load_lane_large_offset (param $ptr i64) (param $val v128) | ||
| (drop (v128.load8_lane offset=4294967296 0 (local.get $ptr) (local.get $val))) | ||
| ) | ||
|
|
||
| ;; CHECK: (func $test_simd_store_lane_large_offset (param $ptr i64) (param $val v128) | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_simd_store_lane_large_offset (param $ptr i64) (param $val v128) | ||
| (v128.store8_lane offset=4294967296 0 (local.get $ptr) (local.get $val)) | ||
| ) | ||
| ) | ||
|
|
||
| (module | ||
| ;; CHECK: (type $0 (func (param i64 i32))) | ||
|
|
||
| ;; CHECK: (type $1 (func (param i64 i32 i32))) | ||
|
|
||
| ;; CHECK: (type $2 (func (param i64 i32 i64))) | ||
|
|
||
| ;; CHECK: (type $3 (func (param i64) (result i32))) | ||
|
|
||
| ;; CHECK: (memory $0 1 1) | ||
| (memory $0 i64 1 1) | ||
|
|
||
| ;; CHECK: (func $test_atomic_rmw_large_offset (param $ptr i64) (param $val i32) | ||
| ;; CHECK-NEXT: (drop | ||
| ;; CHECK-NEXT: (block | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_atomic_rmw_large_offset (param $ptr i64) (param $val i32) | ||
| (drop (i32.atomic.rmw.add offset=4294967296 (local.get $ptr) (local.get $val))) | ||
| ) | ||
|
|
||
| ;; CHECK: (func $test_atomic_cmpxchg_large_offset (param $ptr i64) (param $exp i32) (param $new i32) | ||
| ;; CHECK-NEXT: (drop | ||
| ;; CHECK-NEXT: (block | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_atomic_cmpxchg_large_offset (param $ptr i64) (param $exp i32) (param $new i32) | ||
| (drop (i32.atomic.rmw.cmpxchg offset=4294967296 (local.get $ptr) (local.get $exp) (local.get $new))) | ||
| ) | ||
|
|
||
| ;; CHECK: (func $test_atomic_wait_large_offset (param $ptr i64) (param $exp i32) (param $timeout i64) | ||
| ;; CHECK-NEXT: (drop | ||
| ;; CHECK-NEXT: (block | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_atomic_wait_large_offset (param $ptr i64) (param $exp i32) (param $timeout i64) | ||
| (drop (memory.atomic.wait32 offset=4294967296 (local.get $ptr) (local.get $exp) (local.get $timeout))) | ||
| ) | ||
|
|
||
| ;; CHECK: (func $test_atomic_notify_large_offset (param $ptr i64) (param $count i32) | ||
| ;; CHECK-NEXT: (drop | ||
| ;; CHECK-NEXT: (block | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_atomic_notify_large_offset (param $ptr i64) (param $count i32) | ||
| (drop (memory.atomic.notify offset=4294967296 (local.get $ptr) (local.get $count))) | ||
| ) | ||
|
|
||
| ;; CHECK: (func $test_large_offsets_effect (param $ptr i64) (result i32) | ||
| ;; CHECK-NEXT: (local $1 i64) | ||
| ;; CHECK-NEXT: (local.set $1 | ||
| ;; CHECK-NEXT: (i64.div_s | ||
| ;; CHECK-NEXT: (i64.const 1337) | ||
| ;; CHECK-NEXT: (local.get $ptr) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: ) | ||
| ;; CHECK-NEXT: (unreachable) | ||
| ;; CHECK-NEXT: ) | ||
| (func $test_large_offsets_effect (param $ptr i64) (result i32) | ||
| (i32.load offset=4294967297 | ||
| ;; This might trap, and must be kept around. | ||
| (i64.div_s | ||
| (i64.const 1337) | ||
| (local.get $ptr) | ||
| ) | ||
| ) | ||
| ) | ||
| ) | ||
dschuff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.