Skip to content

Commit 997f6d4

Browse files
committed
Revert "Reapply "IRGen: Fix select_enum for single-payload, multi-empty-case enums.""
This reverts commit 299a568 because it looks like the test is broken for the iphonesimulator-i386 target.
1 parent 97811fe commit 997f6d4

File tree

2 files changed

+5
-46
lines changed

2 files changed

+5
-46
lines changed

lib/IRGen/GenEnum.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,20 +1539,13 @@ namespace {
15391539
std::tie(payloadTag, extraTag) = getNoPayloadCaseValue(Case);
15401540

15411541
auto &ti = getFixedPayloadTypeInfo();
1542-
1542+
bool hasExtraInhabitants = ti.getFixedExtraInhabitantCount(IGF.IGM) > 0;
1543+
15431544
llvm::Value *payloadResult = nullptr;
1544-
// We can omit the payload check if this is the only case represented with
1545-
// the particular extra tag bit pattern set.
1546-
//
1547-
// TODO: This logic covers the most common case, when there's exactly one
1548-
// more no-payload case than extra inhabitants in the payload. This could
1549-
// be slightly generalized to cases where there's multiple tag bits and
1550-
// exactly one no-payload case in the highest used tag value.
1551-
if (!tagBits ||
1552-
ElementsWithNoPayload.size() != getFixedExtraInhabitantCount(IGF.IGM)+1)
1553-
payloadResult = payload.emitCompare(IGF,
1545+
if (hasExtraInhabitants)
1546+
payloadResult = payload.emitCompare(IGF,
15541547
ti.getFixedExtraInhabitantMask(IGF.IGM),
1555-
payloadTag);
1548+
payloadTag);
15561549

15571550
// If any tag bits are present, they must match.
15581551
llvm::Value *tagResult = nullptr;

test/IRGen/select_enum_single_payload.sil

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)