|
1097 | 1097 | ;; NO_TNH: (rec |
1098 | 1098 | ;; NO_TNH-NEXT: (type $A (sub (descriptor $B (struct)))) |
1099 | 1099 | (type $A (sub (descriptor $B (struct)))) |
1100 | | - ;; YESTNH: (type $B (describes $A (struct))) |
1101 | | - ;; NO_TNH: (type $B (describes $A (struct))) |
| 1100 | + ;; YESTNH: (type $B (sub (describes $A (struct)))) |
| 1101 | + ;; NO_TNH: (type $B (sub (describes $A (struct)))) |
1102 | 1102 | (type $B (sub (describes $A (struct)))) |
1103 | 1103 |
|
| 1104 | + ;; YESTNH: (type $A.sub (sub $A (descriptor $B.sub (struct)))) |
| 1105 | + ;; NO_TNH: (type $A.sub (sub $A (descriptor $B.sub (struct)))) |
1104 | 1106 | (type $A.sub (sub $A (descriptor $B.sub (struct)))) |
| 1107 | + ;; YESTNH: (type $B.sub (sub $B (describes $A.sub (struct)))) |
| 1108 | + ;; NO_TNH: (type $B.sub (sub $B (describes $A.sub (struct)))) |
1105 | 1109 | (type $B.sub (sub $B (describes $A.sub (struct)))) |
1106 | 1110 | ) |
1107 | 1111 |
|
| 1112 | + ;; YESTNH: (type $4 (func)) |
| 1113 | + |
| 1114 | + ;; YESTNH: (type $5 (func (result (ref (exact $B.sub))))) |
| 1115 | + |
| 1116 | + ;; YESTNH: (type $6 (func (param (ref $A)) (result (ref $B.sub)))) |
| 1117 | + |
| 1118 | + ;; YESTNH: (func $create (type $4) |
| 1119 | + ;; YESTNH-NEXT: (drop |
| 1120 | + ;; YESTNH-NEXT: (struct.new_default $A.sub |
| 1121 | + ;; YESTNH-NEXT: (struct.new_default $B.sub) |
| 1122 | + ;; YESTNH-NEXT: ) |
| 1123 | + ;; YESTNH-NEXT: ) |
| 1124 | + ;; YESTNH-NEXT: ) |
| 1125 | + ;; NO_TNH: (type $4 (func)) |
| 1126 | + |
| 1127 | + ;; NO_TNH: (type $5 (func (result (ref (exact $B))))) |
| 1128 | + |
| 1129 | + ;; NO_TNH: (type $6 (func (param (ref $A)) (result (ref $B)))) |
| 1130 | + |
| 1131 | + ;; NO_TNH: (func $create (type $4) |
| 1132 | + ;; NO_TNH-NEXT: (drop |
| 1133 | + ;; NO_TNH-NEXT: (struct.new_default $A.sub |
| 1134 | + ;; NO_TNH-NEXT: (struct.new_default $B.sub) |
| 1135 | + ;; NO_TNH-NEXT: ) |
| 1136 | + ;; NO_TNH-NEXT: ) |
| 1137 | + ;; NO_TNH-NEXT: ) |
1108 | 1138 | (func $create |
1109 | 1139 | ;; Make the subtypes not abstract. |
1110 | 1140 | (drop |
|
1114 | 1144 | ) |
1115 | 1145 | ) |
1116 | 1146 |
|
1117 | | - ;; YESTNH: (type $2 (func (result (ref none)))) |
1118 | | - |
1119 | | - ;; YESTNH: (type $3 (func (param (ref $A)) (result (ref none)))) |
1120 | | - |
1121 | | - ;; YESTNH: (func $test (type $2) (result (ref none)) |
| 1147 | + ;; YESTNH: (func $test (type $5) (result (ref (exact $B.sub))) |
1122 | 1148 | ;; YESTNH-NEXT: (drop |
1123 | 1149 | ;; YESTNH-NEXT: (struct.new_default $A |
1124 | 1150 | ;; YESTNH-NEXT: (ref.null none) |
1125 | 1151 | ;; YESTNH-NEXT: ) |
1126 | 1152 | ;; YESTNH-NEXT: ) |
1127 | 1153 | ;; YESTNH-NEXT: (unreachable) |
1128 | 1154 | ;; YESTNH-NEXT: ) |
1129 | | - ;; NO_TNH: (type $2 (func (result (ref none)))) |
1130 | | - |
1131 | | - ;; NO_TNH: (type $3 (func (param (ref $A)) (result (ref none)))) |
1132 | | - |
1133 | | - ;; NO_TNH: (func $test (type $2) (result (ref none)) |
1134 | | - ;; NO_TNH-NEXT: (drop |
| 1155 | + ;; NO_TNH: (func $test (type $5) (result (ref (exact $B))) |
| 1156 | + ;; NO_TNH-NEXT: (ref.get_desc $A |
1135 | 1157 | ;; NO_TNH-NEXT: (struct.new_default $A |
1136 | 1158 | ;; NO_TNH-NEXT: (ref.null none) |
1137 | 1159 | ;; NO_TNH-NEXT: ) |
1138 | 1160 | ;; NO_TNH-NEXT: ) |
1139 | | - ;; NO_TNH-NEXT: (unreachable) |
1140 | 1161 | ;; NO_TNH-NEXT: ) |
1141 | 1162 | (func $test (result (ref (exact $B))) |
1142 | | - ;; We can still optimize here, thanks to exactness. |
| 1163 | + ;; We can still optimize here, thanks to exactness (when TNH). |
1143 | 1164 | (ref.get_desc $A |
1144 | 1165 | (struct.new_default $A |
1145 | 1166 | (ref.null none) |
1146 | 1167 | ) |
1147 | 1168 | ) |
1148 | 1169 | ) |
1149 | 1170 |
|
1150 | | - ;; YESTNH: (func $inexact (type $3) (param $inexact (ref $A)) (result (ref none)) |
1151 | | - ;; YESTNH-NEXT: (drop |
1152 | | - ;; YESTNH-NEXT: (local.get $inexact) |
| 1171 | + ;; YESTNH: (func $inexact (type $6) (param $inexact (ref $A)) (result (ref $B.sub)) |
| 1172 | + ;; YESTNH-NEXT: (ref.get_desc $A.sub |
| 1173 | + ;; YESTNH-NEXT: (ref.cast (ref $A.sub) |
| 1174 | + ;; YESTNH-NEXT: (local.get $inexact) |
| 1175 | + ;; YESTNH-NEXT: ) |
1153 | 1176 | ;; YESTNH-NEXT: ) |
1154 | | - ;; YESTNH-NEXT: (unreachable) |
1155 | 1177 | ;; YESTNH-NEXT: ) |
1156 | | - ;; NO_TNH: (func $inexact (type $3) (param $inexact (ref $A)) (result (ref none)) |
1157 | | - ;; NO_TNH-NEXT: (drop |
| 1178 | + ;; NO_TNH: (func $inexact (type $6) (param $inexact (ref $A)) (result (ref $B)) |
| 1179 | + ;; NO_TNH-NEXT: (ref.get_desc $A |
1158 | 1180 | ;; NO_TNH-NEXT: (local.get $inexact) |
1159 | 1181 | ;; NO_TNH-NEXT: ) |
1160 | | - ;; NO_TNH-NEXT: (unreachable) |
1161 | 1182 | ;; NO_TNH-NEXT: ) |
1162 | 1183 | (func $inexact (param $inexact (ref $A)) (result (ref $B)) |
1163 | 1184 | ;; We do not optimize to an unreachable here, as the inexact reference may |
1164 | | - ;; contain an $A.sub. We optimize to that. |
| 1185 | + ;; contain an $A.sub. We optimize to that, using a cast (in TNH). |
1165 | 1186 | (ref.get_desc $A |
1166 | 1187 | (local.get $inexact) |
1167 | 1188 | ) |
|
0 commit comments