Skip to content

Commit 6ec935a

Browse files
authored
Merge pull request #14026 from aschwaighofer/irgen_fix_ub_shift
2 parents c23cc1e + c842c34 commit 6ec935a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/IRGen/GenEnum.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5851,7 +5851,8 @@ MultiPayloadEnumImplStrategy::completeFixedLayout(TypeConverter &TC,
58515851
unsigned numTagBits = llvm::Log2_32(numTags-1) + 1;
58525852
ExtraTagBitCount = numTagBits <= commonSpareBitCount
58535853
? 0 : numTagBits - commonSpareBitCount;
5854-
NumExtraTagValues = numTags >> commonSpareBitCount;
5854+
NumExtraTagValues =
5855+
(commonSpareBitCount < 32) ? numTags >> commonSpareBitCount : 0;
58555856

58565857
// Create the type. We need enough bits to store the largest payload plus
58575858
// extra tag bits we need.

0 commit comments

Comments
 (0)