Skip to content

Commit a6f7758

Browse files
committed
[NFC] SIL: Expose undef values.
1 parent 738f01e commit a6f7758

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "swift/SIL/SILDeclRef.h"
2929
#include "swift/SIL/SILLinkage.h"
3030
#include "swift/SIL/SILPrintContext.h"
31+
#include "swift/SIL/SILUndef.h"
32+
#include "llvm/ADT/MapVector.h"
3133

3234
namespace swift {
3335

@@ -337,12 +339,8 @@ class SILFunction
337339

338340
PerformanceConstraints perfConstraints = PerformanceConstraints::None;
339341

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;
346344

347345
/// This is the number of uses of this SILFunction inside the SIL.
348346
/// It does not include references from debug scopes.
@@ -1605,6 +1603,10 @@ class SILFunction
16051603
decl->getLifetimeAnnotation());
16061604
}
16071605

1606+
ArrayRef<std::pair<SILType, SILUndef *>> getUndefValues() {
1607+
return {undefValues.begin(), undefValues.end()};
1608+
}
1609+
16081610
/// verify - Run the SIL verifier to make sure that the SILFunction follows
16091611
/// invariants.
16101612
void verify(CalleeCache *calleeCache = nullptr,

0 commit comments

Comments
 (0)