File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -317,7 +317,7 @@ struct PostEmscripten : public Pass {
317317 // The first operand is the function pointer index, which must be
318318 // constant if we are to optimize it statically.
319319 if (auto * index = curr->operands [0 ]->dynCast <Const>()) {
320- size_t indexValue = index->value .geti32 ();
320+ size_t indexValue = index->value .getInteger ();
321321 if (indexValue >= flatTable.names .size ()) {
322322 // UB can lead to indirect calls to invalid pointers.
323323 return ;
Original file line number Diff line number Diff line change 1+ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
2+ ;; RUN: wasm-opt %s --post-emscripten -all -S -o - | filecheck %s
3+
4+ ;; Test we do not error on invoke calls that take an i64 index (which is the
5+ ;; case in wasm64). Nothing should change here.
6+
7+ (module
8+ ;; CHECK: (type $0 (func (param i64)))
9+
10+ ;; CHECK: (type $1 (func))
11+
12+ ;; CHECK: (import "env" "invoke_v" (func $invoke (type $0) (param i64)))
13+ (import " env" " invoke_v" (func $invoke (param i64 )))
14+
15+ ;; CHECK: (table $0 269 269 funcref)
16+ (table $0 269 269 funcref )
17+ ;; CHECK: (elem $0 (i32.const 1))
18+ (elem $0 (i32.const 1 ))
19+
20+ ;; CHECK: (func $0 (type $1)
21+ ;; CHECK-NEXT: (call $invoke
22+ ;; CHECK-NEXT: (i64.const 42)
23+ ;; CHECK-NEXT: )
24+ ;; CHECK-NEXT: )
25+ (func $0
26+ (call $invoke
27+ (i64.const 42 )
28+ )
29+ )
30+ )
31+
You can’t perform that action at this time.
0 commit comments