Commit c40f7c3
committed
[OwnershipUtils] Undef isn't introduced/enclosed.
Previously, calling `visitEnclosingDefs` or `visitBorrowIntroducers`
would crash if the `SILValue` argument were an instance of `SILUndef`
because both instantiate a `::FindEnclosingDefs` with the the result of
of calling `getFunction()` on that argument and `::FindEnclosingDefs` in
turn uses that result to create a `ValueSet`; but
`SILUndef::getFunction` returns `nullptr`, which is illegal to use as
the function for a `ValueSet`(or any other data structure relying on
`NodeBits`).
If the function specified as a separate argument, no values would be
visited and `true` would be returned. Instead of burdening the API with
a separate argument, check for `SILUndef` up front and return `true`.1 parent cc0f42f commit c40f7c3
File tree
2 files changed
+23
-0
lines changed- lib/SIL/Utils
- test/SILOptimizer
2 files changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2230 | 2230 | | |
2231 | 2231 | | |
2232 | 2232 | | |
| 2233 | + | |
| 2234 | + | |
2233 | 2235 | | |
2234 | 2236 | | |
2235 | 2237 | | |
2236 | 2238 | | |
2237 | 2239 | | |
2238 | 2240 | | |
| 2241 | + | |
| 2242 | + | |
2239 | 2243 | | |
2240 | 2244 | | |
2241 | 2245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
0 commit comments