|
28 | 28 | #include "swift/SIL/SILDeclRef.h"
|
29 | 29 | #include "swift/SIL/SILLinkage.h"
|
30 | 30 | #include "swift/SIL/SILPrintContext.h"
|
| 31 | +#include "llvm/ADT/MapVector.h" |
31 | 32 |
|
32 | 33 | namespace swift {
|
33 | 34 |
|
@@ -337,12 +338,8 @@ class SILFunction
|
337 | 338 |
|
338 | 339 | PerformanceConstraints perfConstraints = PerformanceConstraints::None;
|
339 | 340 |
|
340 |
| - /// This is the set of undef values we've created, for uniquing purposes. |
341 |
| - /// |
342 |
| - /// We use a SmallDenseMap since in most functions, we will have only one type |
343 |
| - /// of undef if we have any at all. In that case, by staying small we avoid |
344 |
| - /// needing a heap allocation. |
345 |
| - llvm::SmallDenseMap<SILType, SILUndef *, 1> undefValues; |
| 341 | + /// The undefs of each type in the function. |
| 342 | + llvm::SmallMapVector<SILType, SILUndef *, 1> undefValues; |
346 | 343 |
|
347 | 344 | /// This is the number of uses of this SILFunction inside the SIL.
|
348 | 345 | /// It does not include references from debug scopes.
|
@@ -1637,6 +1634,10 @@ class SILFunction
|
1637 | 1634 | decl->getLifetimeAnnotation());
|
1638 | 1635 | }
|
1639 | 1636 |
|
| 1637 | + ArrayRef<std::pair<SILType, SILUndef *>> getUndefValues() { |
| 1638 | + return {undefValues.begin(), undefValues.end()}; |
| 1639 | + } |
| 1640 | + |
1640 | 1641 | /// verify - Run the SIL verifier to make sure that the SILFunction follows
|
1641 | 1642 | /// invariants.
|
1642 | 1643 | void verify(CalleeCache *calleeCache = nullptr,
|
|
0 commit comments