|
236 | 236 | ;; T_N_H: (export "mem" (memory $mem)) |
237 | 237 | (export "mem" (memory $mem)) |
238 | 238 | ) |
| 239 | + |
| 240 | +;; The exported function has a call_indirect, which refers to the table and |
| 241 | +;; elem. The elem refers to the global, so it must not be removed (in either TNH |
| 242 | +;; or not). |
| 243 | +(module |
| 244 | + ;; CHECK: (type $nop (func)) |
| 245 | + ;; T_N_H: (type $nop (func)) |
| 246 | + (type $nop (func)) |
| 247 | + |
| 248 | + ;; CHECK: (global $g i32 (i32.const 0)) |
| 249 | + ;; T_N_H: (global $g i32 (i32.const 0)) |
| 250 | + (global $g i32 (i32.const 0)) |
| 251 | + |
| 252 | + ;; CHECK: (table $table 50 50 funcref) |
| 253 | + ;; T_N_H: (table $table 50 50 funcref) |
| 254 | + (table $table 50 50 funcref) |
| 255 | + |
| 256 | + ;; CHECK: (elem $elem (global.get $g) $func) |
| 257 | + ;; T_N_H: (elem $elem (global.get $g) $func) |
| 258 | + (elem $elem (global.get $g) $func) |
| 259 | + |
| 260 | + ;; CHECK: (export "func" (func $func)) |
| 261 | + |
| 262 | + ;; CHECK: (func $func (type $nop) |
| 263 | + ;; CHECK-NEXT: (call_indirect $table (type $nop) |
| 264 | + ;; CHECK-NEXT: (i32.const 0) |
| 265 | + ;; CHECK-NEXT: ) |
| 266 | + ;; CHECK-NEXT: ) |
| 267 | + ;; T_N_H: (export "func" (func $func)) |
| 268 | + |
| 269 | + ;; T_N_H: (func $func (type $nop) |
| 270 | + ;; T_N_H-NEXT: (call_indirect $table (type $nop) |
| 271 | + ;; T_N_H-NEXT: (i32.const 0) |
| 272 | + ;; T_N_H-NEXT: ) |
| 273 | + ;; T_N_H-NEXT: ) |
| 274 | + (func $func (export "func") (type $nop) |
| 275 | + (call_indirect (type $nop) |
| 276 | + (i32.const 0) |
| 277 | + ) |
| 278 | + ) |
| 279 | +) |
| 280 | + |
0 commit comments