|
28 | 28 | #include "swift/SIL/SILDeclRef.h" |
29 | 29 | #include "swift/SIL/SILLinkage.h" |
30 | 30 | #include "swift/SIL/SILPrintContext.h" |
| 31 | +#include "swift/SIL/SILUndef.h" |
| 32 | +#include "llvm/ADT/MapVector.h" |
31 | 33 |
|
32 | 34 | namespace swift { |
33 | 35 |
|
@@ -337,12 +339,8 @@ class SILFunction |
337 | 339 |
|
338 | 340 | PerformanceConstraints perfConstraints = PerformanceConstraints::None; |
339 | 341 |
|
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; |
| 342 | + /// The undefs of each type in the function. |
| 343 | + llvm::SmallMapVector<SILType, SILUndef *, 1> undefValues; |
346 | 344 |
|
347 | 345 | /// This is the number of uses of this SILFunction inside the SIL. |
348 | 346 | /// It does not include references from debug scopes. |
@@ -1637,6 +1635,10 @@ class SILFunction |
1637 | 1635 | decl->getLifetimeAnnotation()); |
1638 | 1636 | } |
1639 | 1637 |
|
| 1638 | + ArrayRef<std::pair<SILType, SILUndef *>> getUndefValues() { |
| 1639 | + return {undefValues.begin(), undefValues.end()}; |
| 1640 | + } |
| 1641 | + |
1640 | 1642 | /// verify - Run the SIL verifier to make sure that the SILFunction follows |
1641 | 1643 | /// invariants. |
1642 | 1644 | void verify(CalleeCache *calleeCache = nullptr, |
|
0 commit comments