Skip to content

Commit 9478aee

Browse files
committed
[NFC] SIL: Expose undef values.
1 parent 4ad9002 commit 9478aee

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

include/swift/SIL/SILFunction.h

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

3233
namespace swift {
3334

@@ -337,12 +338,8 @@ class SILFunction
337338

338339
PerformanceConstraints perfConstraints = PerformanceConstraints::None;
339340

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

347344
/// This is the number of uses of this SILFunction inside the SIL.
348345
/// It does not include references from debug scopes.
@@ -1637,6 +1634,10 @@ class SILFunction
16371634
decl->getLifetimeAnnotation());
16381635
}
16391636

1637+
ArrayRef<std::pair<SILType, SILUndef *>> getUndefValues() {
1638+
return {undefValues.begin(), undefValues.end()};
1639+
}
1640+
16401641
/// verify - Run the SIL verifier to make sure that the SILFunction follows
16411642
/// invariants.
16421643
void verify(CalleeCache *calleeCache = nullptr,

0 commit comments

Comments
 (0)