mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IRGen] Fix computation of spare bits for fixed arrays
rdar://159143492 Previously all bits after the spare bits of the first element were marked as spare bits. This caused enum tags to be stored in bits used by the payload.
This commit is contained in:
@@ -248,9 +248,15 @@ protected:
|
||||
|
||||
// Take spare bits from the first element only.
|
||||
SpareBitVector result = elementTI.getSpareBits();
|
||||
|
||||
// We can use the padding to the next element as spare bits too.
|
||||
result.appendSetBits(getArraySize(arraySize, elementTI).getValueInBits()
|
||||
- result.size());
|
||||
auto padding = elementTI.getFixedStride() - elementTI.getFixedSize();
|
||||
result.appendSetBits(padding.getValueInBits());
|
||||
|
||||
// spare bits of any other elements should not be considered
|
||||
result.appendClearBits(
|
||||
getArraySize(arraySize - 1, elementTI).getValueInBits());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user