summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ir/table-utils.h2
-rw-r--r--test/lit/passes/directize_all-features.wast16
2 files changed, 13 insertions, 5 deletions
diff --git a/src/ir/table-utils.h b/src/ir/table-utils.h
index 5299ba3e1..76cc9f479 100644
--- a/src/ir/table-utils.h
+++ b/src/ir/table-utils.h
@@ -40,7 +40,7 @@ struct FlatTable {
valid = false;
return;
}
- Index start = offset->cast<Const>()->value.geti32();
+ Index start = offset->cast<Const>()->value.getInteger();
Index size = segment->data.size();
Index end;
if (std::ckd_add(&end, start, size) || end > table.initial) {
diff --git a/test/lit/passes/directize_all-features.wast b/test/lit/passes/directize_all-features.wast
index c1308faad..997992b07 100644
--- a/test/lit/passes/directize_all-features.wast
+++ b/test/lit/passes/directize_all-features.wast
@@ -12,15 +12,23 @@
;; CHECK: (table $0 5 5 funcref)
;; IMMUT: (table $0 5 5 funcref)
(table $0 5 5 funcref)
- (elem (i32.const 1) $foo)
+ ;; CHECK: (table $t64 i64 5 5 funcref)
- ;; CHECK: (elem $0 (i32.const 1) $foo)
+ ;; CHECK: (elem $elem (table $0) (i32.const 1) func $foo)
+ ;; IMMUT: (table $t64 i64 5 5 funcref)
+
+ ;; IMMUT: (elem $elem (table $0) (i32.const 1) func $foo)
+ (elem $elem (i32.const 1) $foo)
+
+ (table $t64 i64 5 5 funcref)
+
+ ;; CHECK: (elem $elem64 (table $t64) (i64.const 1) func $foo)
+ ;; IMMUT: (elem $elem64 (table $t64) (i64.const 1) func $foo)
+ (elem $elem64 (table $t64) (i64.const 1) funcref (ref.func $foo))
;; CHECK: (func $foo (type $ii) (param $0 i32) (param $1 i32)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
- ;; IMMUT: (elem $0 (i32.const 1) $foo)
-
;; IMMUT: (func $foo (type $ii) (param $0 i32) (param $1 i32)
;; IMMUT-NEXT: (unreachable)
;; IMMUT-NEXT: )