|
15 | 15 |
|
16 | 16 | ;; CHECK: (type $func-return-i32 (func (result i32)))
|
17 | 17 |
|
| 18 | + ;; CHECK: (type $array-i32 (array (mut i32))) |
| 19 | + |
18 | 20 | ;; CHECK: (type $B (struct (field (mut f64))))
|
19 | 21 | (type $B (struct (field (mut f64))))
|
20 | 22 |
|
21 | 23 | (type $struct_i8 (struct (field i8)))
|
22 | 24 |
|
23 | 25 | (type $func-return-i32 (func (result i32)))
|
24 | 26 |
|
25 |
| - ;; CHECK: (import "fuzzing-support" "log-i32" (func $log (type $4) (param i32))) |
| 27 | + (type $array-i32 (array (mut i32))) |
| 28 | + |
| 29 | + ;; CHECK: (type $array-ref (array (mut (ref null $array-i32)))) |
| 30 | + (type $array-ref (array (mut (ref null $array-i32)))) |
| 31 | + |
| 32 | + ;; CHECK: (import "fuzzing-support" "log-i32" (func $log (type $5) (param i32))) |
26 | 33 | (import "fuzzing-support" "log-i32" (func $log (param i32)))
|
27 | 34 |
|
28 | 35 | ;; CHECK: (func $test-fallthrough (type $func-return-i32) (result i32)
|
|
57 | 64 | )
|
58 | 65 | )
|
59 | 66 |
|
60 |
| - ;; CHECK: (func $load-from-struct (type $3) |
| 67 | + ;; CHECK: (func $load-from-struct (type $2) |
61 | 68 | ;; CHECK-NEXT: (local $x (ref null $struct))
|
62 | 69 | ;; CHECK-NEXT: (local.set $x
|
63 | 70 | ;; CHECK-NEXT: (struct.new $struct
|
|
119 | 126 | (struct.get $struct 0 (local.get $x))
|
120 | 127 | )
|
121 | 128 | )
|
122 |
| - ;; CHECK: (func $load-from-struct-bad-merge (type $4) (param $i i32) |
| 129 | + ;; CHECK: (func $load-from-struct-bad-merge (type $5) (param $i i32) |
123 | 130 | ;; CHECK-NEXT: (local $x (ref null $struct))
|
124 | 131 | ;; CHECK-NEXT: (if
|
125 | 132 | ;; CHECK-NEXT: (local.get $i)
|
|
168 | 175 | (struct.get $struct 0 (local.get $x))
|
169 | 176 | )
|
170 | 177 | )
|
171 |
| - ;; CHECK: (func $modify-gc-heap (type $5) (param $x (ref null $struct)) |
| 178 | + ;; CHECK: (func $modify-gc-heap (type $6) (param $x (ref null $struct)) |
172 | 179 | ;; CHECK-NEXT: (struct.set $struct 0
|
173 | 180 | ;; CHECK-NEXT: (local.get $x)
|
174 | 181 | ;; CHECK-NEXT: (i32.add
|
|
192 | 199 | )
|
193 | 200 | ;; --fuzz-exec verifies the output of this function, checking that the change
|
194 | 201 | ;; makde in modify-gc-heap is not ignored
|
195 |
| - ;; CHECK: (func $load-from-struct-bad-escape (type $3) |
| 202 | + ;; CHECK: (func $load-from-struct-bad-escape (type $2) |
196 | 203 | ;; CHECK-NEXT: (local $x (ref null $struct))
|
197 | 204 | ;; CHECK-NEXT: (local.set $x
|
198 | 205 | ;; CHECK-NEXT: (struct.new $struct
|
|
222 | 229 | (struct.get $struct 0 (local.get $x))
|
223 | 230 | )
|
224 | 231 | )
|
225 |
| - ;; CHECK: (func $load-from-struct-bad-arrive (type $5) (param $x (ref null $struct)) |
| 232 | + ;; CHECK: (func $load-from-struct-bad-arrive (type $6) (param $x (ref null $struct)) |
226 | 233 | ;; CHECK-NEXT: (call $log
|
227 | 234 | ;; CHECK-NEXT: (struct.get $struct 0
|
228 | 235 | ;; CHECK-NEXT: (local.get $x)
|
|
235 | 242 | (struct.get $struct 0 (local.get $x))
|
236 | 243 | )
|
237 | 244 | )
|
238 |
| - ;; CHECK: (func $ref-comparisons (type $11) (param $x (ref null $struct)) (param $y (ref null $struct)) |
| 245 | + ;; CHECK: (func $ref-comparisons (type $12) (param $x (ref null $struct)) (param $y (ref null $struct)) |
239 | 246 | ;; CHECK-NEXT: (local $z (ref null $struct))
|
240 | 247 | ;; CHECK-NEXT: (local $w (ref null $struct))
|
241 | 248 | ;; CHECK-NEXT: (call $log
|
|
388 | 395 | (local.get $tempresult)
|
389 | 396 | )
|
390 | 397 |
|
391 |
| - ;; CHECK: (func $propagate-uncertain-param (type $6) (param $input (ref $empty)) (result i32) |
| 398 | + ;; CHECK: (func $propagate-uncertain-param (type $7) (param $input (ref $empty)) (result i32) |
392 | 399 | ;; CHECK-NEXT: (local $tempresult i32)
|
393 | 400 | ;; CHECK-NEXT: (local $tempref (ref null $empty))
|
394 | 401 | ;; CHECK-NEXT: (local.set $tempresult
|
|
413 | 420 | (local.get $tempresult)
|
414 | 421 | )
|
415 | 422 |
|
416 |
| - ;; CHECK: (func $propagate-different-params (type $12) (param $input1 (ref $empty)) (param $input2 (ref $empty)) (result i32) |
| 423 | + ;; CHECK: (func $propagate-different-params (type $13) (param $input1 (ref $empty)) (param $input2 (ref $empty)) (result i32) |
417 | 424 | ;; CHECK-NEXT: (local $tempresult i32)
|
418 | 425 | ;; CHECK-NEXT: (local.set $tempresult
|
419 | 426 | ;; CHECK-NEXT: (ref.eq
|
|
435 | 442 | (local.get $tempresult)
|
436 | 443 | )
|
437 | 444 |
|
438 |
| - ;; CHECK: (func $propagate-same-param (type $6) (param $input (ref $empty)) (result i32) |
| 445 | + ;; CHECK: (func $propagate-same-param (type $7) (param $input (ref $empty)) (result i32) |
439 | 446 | ;; CHECK-NEXT: (local $tempresult i32)
|
440 | 447 | ;; CHECK-NEXT: (local.set $tempresult
|
441 | 448 | ;; CHECK-NEXT: (ref.eq
|
|
517 | 524 | (local.get $tempresult)
|
518 | 525 | )
|
519 | 526 |
|
520 |
| - ;; CHECK: (func $propagate-uncertain-loop (type $3) |
| 527 | + ;; CHECK: (func $propagate-uncertain-loop (type $2) |
521 | 528 | ;; CHECK-NEXT: (local $tempresult i32)
|
522 | 529 | ;; CHECK-NEXT: (local $tempref (ref null $empty))
|
523 | 530 | ;; CHECK-NEXT: (local $stashedref (ref null $empty))
|
|
574 | 581 | )
|
575 | 582 | )
|
576 | 583 |
|
577 |
| - ;; CHECK: (func $propagate-certain-loop (type $3) |
| 584 | + ;; CHECK: (func $propagate-certain-loop (type $2) |
578 | 585 | ;; CHECK-NEXT: (local $tempresult i32)
|
579 | 586 | ;; CHECK-NEXT: (local $tempref (ref null $empty))
|
580 | 587 | ;; CHECK-NEXT: (local $stashedref (ref null $empty))
|
|
622 | 629 | )
|
623 | 630 | )
|
624 | 631 |
|
625 |
| - ;; CHECK: (func $propagate-certain-loop-2 (type $3) |
| 632 | + ;; CHECK: (func $propagate-certain-loop-2 (type $2) |
626 | 633 | ;; CHECK-NEXT: (local $tempresult i32)
|
627 | 634 | ;; CHECK-NEXT: (local $tempref (ref null $empty))
|
628 | 635 | ;; CHECK-NEXT: (local $stashedref (ref null $empty))
|
|
670 | 677 | )
|
671 | 678 | )
|
672 | 679 |
|
673 |
| - ;; CHECK: (func $propagate-possibly-certain-loop (type $3) |
| 680 | + ;; CHECK: (func $propagate-possibly-certain-loop (type $2) |
674 | 681 | ;; CHECK-NEXT: (local $tempresult i32)
|
675 | 682 | ;; CHECK-NEXT: (local $tempref (ref null $empty))
|
676 | 683 | ;; CHECK-NEXT: (local $stashedref (ref null $empty))
|
|
737 | 744 | )
|
738 | 745 | )
|
739 | 746 |
|
740 |
| - ;; CHECK: (func $helper (type $13) (param $0 i32) (result i32) |
| 747 | + ;; CHECK: (func $helper (type $14) (param $0 i32) (result i32) |
741 | 748 | ;; CHECK-NEXT: (unreachable)
|
742 | 749 | ;; CHECK-NEXT: )
|
743 | 750 | (func $helper (param i32) (result i32)
|
744 | 751 | (unreachable)
|
745 | 752 | )
|
746 | 753 |
|
747 |
| - ;; CHECK: (func $odd-cast-and-get (type $3) |
| 754 | + ;; CHECK: (func $odd-cast-and-get (type $2) |
748 | 755 | ;; CHECK-NEXT: (local $temp (ref null $B))
|
749 | 756 | ;; CHECK-NEXT: (local.set $temp
|
750 | 757 | ;; CHECK-NEXT: (ref.null none)
|
|
778 | 785 | )
|
779 | 786 | )
|
780 | 787 |
|
781 |
| - ;; CHECK: (func $odd-cast-and-get-tuple (type $3) |
| 788 | + ;; CHECK: (func $odd-cast-and-get-tuple (type $2) |
782 | 789 | ;; CHECK-NEXT: (local $temp (tuple (ref null $B) i32))
|
783 | 790 | ;; CHECK-NEXT: (local.set $temp
|
784 | 791 | ;; CHECK-NEXT: (tuple.make 2
|
|
815 | 822 | )
|
816 | 823 | )
|
817 | 824 |
|
818 |
| - ;; CHECK: (func $receive-f64 (type $14) (param $0 f64) |
| 825 | + ;; CHECK: (func $receive-f64 (type $15) (param $0 f64) |
819 | 826 | ;; CHECK-NEXT: (unreachable)
|
820 | 827 | ;; CHECK-NEXT: )
|
821 | 828 | (func $receive-f64 (param f64)
|
822 | 829 | (unreachable)
|
823 | 830 | )
|
824 | 831 |
|
825 |
| - ;; CHECK: (func $odd-cast-and-get-non-null (type $15) (param $temp (ref $func-return-i32)) |
| 832 | + ;; CHECK: (func $odd-cast-and-get-non-null (type $16) (param $temp (ref $func-return-i32)) |
826 | 833 | ;; CHECK-NEXT: (local.set $temp
|
827 | 834 | ;; CHECK-NEXT: (ref.cast (ref nofunc)
|
828 | 835 | ;; CHECK-NEXT: (ref.func $receive-f64)
|
|
850 | 857 | )
|
851 | 858 | )
|
852 | 859 |
|
853 |
| - ;; CHECK: (func $new_block_unreachable (type $8) (result anyref) |
| 860 | + ;; CHECK: (func $new_block_unreachable (type $9) (result anyref) |
854 | 861 | ;; CHECK-NEXT: (block ;; (replaces unreachable StructNew we can't emit)
|
855 | 862 | ;; CHECK-NEXT: (drop
|
856 | 863 | ;; CHECK-NEXT: (block
|
|
871 | 878 | )
|
872 | 879 | )
|
873 | 880 |
|
874 |
| - ;; CHECK: (func $br_on_cast-on-creation (type $16) (result (ref $empty)) |
| 881 | + ;; CHECK: (func $br_on_cast-on-creation (type $17) (result (ref $empty)) |
875 | 882 | ;; CHECK-NEXT: (block $label (result (ref (exact $empty)))
|
876 | 883 | ;; CHECK-NEXT: (drop
|
877 | 884 | ;; CHECK-NEXT: (br_on_cast $label (ref (exact $empty)) (ref (exact $empty))
|
|
892 | 899 | )
|
893 | 900 | )
|
894 | 901 |
|
895 |
| - ;; CHECK: (func $ref.is_null (type $4) (param $param i32) |
| 902 | + ;; CHECK: (func $ref.is_null (type $5) (param $param i32) |
896 | 903 | ;; CHECK-NEXT: (local $ref (ref null $empty))
|
897 | 904 | ;; CHECK-NEXT: (local.set $ref
|
898 | 905 | ;; CHECK-NEXT: (struct.new_default $empty)
|
|
970 | 977 | )
|
971 | 978 | )
|
972 | 979 |
|
973 |
| - ;; CHECK: (func $remove-set (type $17) (result (ref func)) |
| 980 | + ;; CHECK: (func $remove-set (type $18) (result (ref func)) |
974 | 981 | ;; CHECK-NEXT: (local $nn funcref)
|
975 | 982 | ;; CHECK-NEXT: (local $i i32)
|
976 | 983 | ;; CHECK-NEXT: (loop $loop
|
|
1013 | 1020 | )
|
1014 | 1021 | )
|
1015 | 1022 |
|
1016 |
| - ;; CHECK: (func $strings (type $18) (param $param (ref string)) |
| 1023 | + ;; CHECK: (func $strings (type $19) (param $param (ref string)) |
1017 | 1024 | ;; CHECK-NEXT: (local $s (ref string))
|
1018 | 1025 | ;; CHECK-NEXT: (local.set $s
|
1019 | 1026 | ;; CHECK-NEXT: (string.const "hello, world")
|
|
1052 | 1059 | )
|
1053 | 1060 | )
|
1054 | 1061 |
|
1055 |
| - ;; CHECK: (func $get-nonnullable-in-unreachable (type $8) (result anyref) |
| 1062 | + ;; CHECK: (func $get-nonnullable-in-unreachable (type $9) (result anyref) |
1056 | 1063 | ;; CHECK-NEXT: (local $x (ref any))
|
1057 | 1064 | ;; CHECK-NEXT: (local.tee $x
|
1058 | 1065 | ;; CHECK-NEXT: (unreachable)
|
|
1089 | 1096 | (local.get $x)
|
1090 | 1097 | )
|
1091 | 1098 |
|
1092 |
| - ;; CHECK: (func $get-nonnullable-in-unreachable-entry (type $9) (param $x i32) (param $y (ref any)) |
| 1099 | + ;; CHECK: (func $get-nonnullable-in-unreachable-entry (type $10) (param $x i32) (param $y (ref any)) |
1093 | 1100 | ;; CHECK-NEXT: (local $0 (ref any))
|
1094 | 1101 | ;; CHECK-NEXT: (unreachable)
|
1095 | 1102 | ;; CHECK-NEXT: (local.set $0
|
|
1123 | 1130 | )
|
1124 | 1131 | )
|
1125 | 1132 |
|
1126 |
| - ;; CHECK: (func $get-nonnullable-in-unreachable-later-loop (type $9) (param $x i32) (param $y (ref any)) |
| 1133 | + ;; CHECK: (func $get-nonnullable-in-unreachable-later-loop (type $10) (param $x i32) (param $y (ref any)) |
1127 | 1134 | ;; CHECK-NEXT: (local $0 (ref any))
|
1128 | 1135 | ;; CHECK-NEXT: (if
|
1129 | 1136 | ;; CHECK-NEXT: (local.get $x)
|
|
1168 | 1175 | )
|
1169 | 1176 | )
|
1170 | 1177 |
|
1171 |
| - ;; CHECK: (func $get-nonnullable-in-unreachable-tuple (type $19) (result anyref i32) |
| 1178 | + ;; CHECK: (func $get-nonnullable-in-unreachable-tuple (type $20) (result anyref i32) |
1172 | 1179 | ;; CHECK-NEXT: (local $x (tuple (ref any) i32))
|
1173 | 1180 | ;; CHECK-NEXT: (local.tee $x
|
1174 | 1181 | ;; CHECK-NEXT: (unreachable)
|
|
1196 | 1203 | )
|
1197 | 1204 | (local.get $x)
|
1198 | 1205 | )
|
| 1206 | + |
| 1207 | + ;; CHECK: (func $propagate-array-effects (type $2) |
| 1208 | + ;; CHECK-NEXT: (local $1 (ref $array-i32)) |
| 1209 | + ;; CHECK-NEXT: (local $2 i32) |
| 1210 | + ;; CHECK-NEXT: (local $3 (ref $array-i32)) |
| 1211 | + ;; CHECK-NEXT: (drop |
| 1212 | + ;; CHECK-NEXT: (i32.lt_u |
| 1213 | + ;; CHECK-NEXT: (local.tee $2 |
| 1214 | + ;; CHECK-NEXT: (select |
| 1215 | + ;; CHECK-NEXT: (i32.const 0) |
| 1216 | + ;; CHECK-NEXT: (block (result i32) |
| 1217 | + ;; CHECK-NEXT: (drop |
| 1218 | + ;; CHECK-NEXT: (array.new $array-ref |
| 1219 | + ;; CHECK-NEXT: (local.tee $1 |
| 1220 | + ;; CHECK-NEXT: (array.new_default $array-i32 |
| 1221 | + ;; CHECK-NEXT: (i32.const 0) |
| 1222 | + ;; CHECK-NEXT: ) |
| 1223 | + ;; CHECK-NEXT: ) |
| 1224 | + ;; CHECK-NEXT: (i32.const 0) |
| 1225 | + ;; CHECK-NEXT: ) |
| 1226 | + ;; CHECK-NEXT: ) |
| 1227 | + ;; CHECK-NEXT: (i32.const 0) |
| 1228 | + ;; CHECK-NEXT: ) |
| 1229 | + ;; CHECK-NEXT: (i32.const 0) |
| 1230 | + ;; CHECK-NEXT: ) |
| 1231 | + ;; CHECK-NEXT: ) |
| 1232 | + ;; CHECK-NEXT: (array.len |
| 1233 | + ;; CHECK-NEXT: (local.tee $3 |
| 1234 | + ;; CHECK-NEXT: (local.get $1) |
| 1235 | + ;; CHECK-NEXT: ) |
| 1236 | + ;; CHECK-NEXT: ) |
| 1237 | + ;; CHECK-NEXT: ) |
| 1238 | + ;; CHECK-NEXT: ) |
| 1239 | + ;; CHECK-NEXT: ) |
| 1240 | + (func $propagate-array-effects |
| 1241 | + (local $1 (ref $array-i32)) |
| 1242 | + (local $2 i32) |
| 1243 | + (local $3 (ref $array-i32)) |
| 1244 | + ;; This dropped expression has several local operations that lead to |
| 1245 | + ;; propagateLocals doing several passes. While doing so, it will try to |
| 1246 | + ;; precompute the value of the outer $array.new. That contains a nested |
| 1247 | + ;; tee, so we cannot replace it with the value we compute, but we do know its |
| 1248 | + ;; value (the canonical allocation for that array.new location). We ignore the |
| 1249 | + ;; local.tee's effect when computing that, but we should not cache the result |
| 1250 | + ;; of that computation and use it for when we *do* care about effects, because |
| 1251 | + ;; if we did then we'd think that entire array.new has no effects, and can be |
| 1252 | + ;; optimized away, together with large chunks of the rest of the code. |
| 1253 | + ;; |
| 1254 | + ;; We should not succeed in optimizing anything away here. |
| 1255 | + (drop |
| 1256 | + (i32.lt_u |
| 1257 | + (local.tee $2 |
| 1258 | + (select |
| 1259 | + (i32.const 0) |
| 1260 | + (block (result i32) |
| 1261 | + (drop |
| 1262 | + (array.new $array-ref |
| 1263 | + (local.tee $1 |
| 1264 | + (array.new_default $array-i32 |
| 1265 | + (i32.const 0) |
| 1266 | + ) |
| 1267 | + ) |
| 1268 | + (i32.const 0) |
| 1269 | + ) |
| 1270 | + ) |
| 1271 | + (i32.const 0) |
| 1272 | + ) |
| 1273 | + (i32.const 0) |
| 1274 | + ) |
| 1275 | + ) |
| 1276 | + (array.len |
| 1277 | + (local.tee $3 |
| 1278 | + (local.get $1) |
| 1279 | + ) |
| 1280 | + ) |
| 1281 | + ) |
| 1282 | + ) |
| 1283 | + ) |
1199 | 1284 | )
|
| 1285 | + |
0 commit comments