|
176 | 176 | ;;; definitions, instead of narrowing the types conservatively. |
177 | 177 | (defun compute-phi-type (phi system) |
178 | 178 | (let ((type (ctype:values-bottom system))) |
179 | | - (set:doset (inp (bir:phi-inputs phi) type) |
180 | | - (setq type (ctype:values-disjoin system type (bir:ctype inp)))))) |
| 179 | + (set:doset (def (bir:definitions phi) type) |
| 180 | + (etypecase def |
| 181 | + ((or bir:jump bir:unwind) |
| 182 | + (let* ((pos (position phi (bir:outputs def))) |
| 183 | + (inp (nth pos (bir:inputs def)))) |
| 184 | + (setq type (ctype:values-disjoin system type (bir:ctype inp))))) |
| 185 | + (bir:catchi ; could be anything. |
| 186 | + (return-from compute-phi-type (ctype:values-top system))))))) |
181 | 187 |
|
182 | 188 | (defun derive-iblock-input-types (iblock system) |
183 | 189 | (dolist (phi (bir:inputs iblock)) |
184 | 190 | (setf (bir:derived-type phi) (compute-phi-type phi system)))) |
185 | 191 |
|
186 | 192 | (defun compute-phi-attributes (phi) |
187 | 193 | (let ((attr t)) |
188 | | - (set:doset (inp (bir:phi-inputs phi) attr) |
189 | | - (setq attr (attributes:meet-attributes attr (bir:attributes inp)))))) |
| 194 | + (set:doset (def (bir:definitions phi) attr) |
| 195 | + (etypecase def |
| 196 | + ((or bir:jump bir:unwind) |
| 197 | + (let* ((pos (position phi (bir:outputs def))) |
| 198 | + (inp (nth pos (bir:inputs def)))) |
| 199 | + (setq attr (attributes:meet-attributes attr (bir:attributes inp))))) |
| 200 | + (bir:catchi |
| 201 | + (return-from compute-phi-attributes (attributes:default-attributes))))))) |
190 | 202 |
|
191 | 203 | (defun derive-iblock-input-attributes (iblock) |
192 | 204 | (dolist (phi (bir:inputs iblock)) |
|
0 commit comments