Skip to content

[IRGen][runtime] Reduce object header to 8 bytes on 32-bit platforms. #12790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions include/swift/Reflection/ReflectionContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ReflectionContext

unsigned getSizeOfHeapObject() {
// This must match sizeof(HeapObject) for the target.
return sizeof(StoredPointer) + 8;
return sizeof(StoredPointer) * 2;
}

void dumpAllSections(std::ostream &OS) {
Expand Down Expand Up @@ -483,9 +483,8 @@ class ReflectionContext
case MetadataSourceKind::ClosureBinding: {
unsigned Index = cast<ClosureBindingMetadataSource>(MS)->getIndex();

// Skip the context's isa pointer (4 or 8 bytes) and reference counts
// (4 bytes each regardless of platform word size). This is just
// sizeof(HeapObject) in the target.
// Skip the context's HeapObject header
// (one word each for isa pointer and reference counts).
//
// Metadata and conformance tables are stored consecutively after
// the heap object header, in the 'necessary bindings' area.
Expand Down
19 changes: 9 additions & 10 deletions lib/IRGen/GenDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3138,11 +3138,10 @@ IRGenModule::getAddrOfGlobalConstantString(StringRef utf8) {
metaclass = llvm::ConstantExpr::getBitCast(metaclass, TypeMetadataPtrTy);

// Get a reference count of two.
auto *strongRefCountInit = llvm::ConstantInt::get(
Int32Ty,
InlineRefCountBits(0 /*unowned ref count*/, 2 /*strong ref count*/)
auto *refCountInit = llvm::ConstantInt::get(
IntPtrTy,
InlineRefCountBits(1 /* "extra" strong ref count*/, 1 /* unowned count */)
.getBitsValue());
auto *unownedRefCountInit = llvm::ConstantInt::get(Int32Ty, 0);

auto *count = llvm::ConstantInt::get(Int32Ty, utf8.size());
// Capacity is length plus one because of the implicitly added '\0'
Expand All @@ -3152,7 +3151,7 @@ IRGenModule::getAddrOfGlobalConstantString(StringRef utf8) {

// FIXME: Big endian-ness.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't break all those 32-bit big endian platforms... we still care about m68k right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not in the tests it doesn't exist.

Having said that the comment no longer applies; any endianness problems would now be inside InlineRefCountBits. I'll remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

llvm::Constant *heapObjectHeaderFields[] = {
metaclass, strongRefCountInit, unownedRefCountInit
metaclass, refCountInit
};

auto *initRefCountStruct = llvm::ConstantStruct::get(
Expand Down Expand Up @@ -3216,19 +3215,19 @@ IRGenModule::getAddrOfGlobalUTF16ConstantString(StringRef utf8) {
metaclass = llvm::ConstantExpr::getBitCast(metaclass, TypeMetadataPtrTy);

// Get a reference count of two.
auto *strongRefCountInit = llvm::ConstantInt::get(
Int32Ty,
InlineRefCountBits(0 /*unowned ref count*/, 2 /*strong ref count*/)
auto *refCountInit = llvm::ConstantInt::get(
IntPtrTy,
InlineRefCountBits(1 /* "extra" strong ref count*/, 1 /* unowned count */)
.getBitsValue());
auto *unownedRefCountInit = llvm::ConstantInt::get(Int32Ty, 0);

auto *count = llvm::ConstantInt::get(Int32Ty, utf16Length);
auto *capacity = llvm::ConstantInt::get(Int32Ty, utf16Length + 1);
auto *flags = llvm::ConstantInt::get(Int8Ty, 0);
auto *padding = llvm::ConstantInt::get(Int8Ty, 0);

// FIXME: Big endian-ness
llvm::Constant *heapObjectHeaderFields[] = {
metaclass, strongRefCountInit, unownedRefCountInit
metaclass, refCountInit
};

auto *initRefCountStruct = llvm::ConstantStruct::get(
Expand Down
4 changes: 2 additions & 2 deletions lib/IRGen/GenExistential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,7 @@ static llvm::Constant *getDeallocateBoxedOpaqueExistentialBufferFunction(

// Size = ((sizeof(HeapObject) + align) & ~align) + size
auto *heapHeaderSize = llvm::ConstantInt::get(
IGF.IGM.SizeTy, getHeapHeaderSize(IGM).getValue());
IGF.IGM.SizeTy, IGM.RefCountedStructSize.getValue());
size = Builder.CreateAdd(
Builder.CreateAnd(Builder.CreateAdd(heapHeaderSize, alignmentMask),
Builder.CreateNot(alignmentMask)),
Expand Down Expand Up @@ -2222,7 +2222,7 @@ getProjectBoxedOpaqueExistentialFunction(IRGenFunction &IGF,

// StartOffset = ((sizeof(HeapObject) + align) & ~align)
auto *heapHeaderSize = llvm::ConstantInt::get(
IGF.IGM.SizeTy, getHeapHeaderSize(IGM).getValue());
IGF.IGM.SizeTy, IGM.RefCountedStructSize.getValue());
auto *startOffset = Builder.CreateAnd(
Builder.CreateAdd(heapHeaderSize, alignmentMask),
Builder.CreateNot(alignmentMask));
Expand Down
6 changes: 3 additions & 3 deletions lib/IRGen/GenValueWitness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ static Address emitDefaultProjectBuffer(IRGenFunction &IGF, Address buffer,
buffer.getAlignment());
auto *boxStart = IGF.Builder.CreateLoad(boxAddress);
auto *alignmentMask = type.getAlignmentMask(IGF, T);
auto *heapHeaderSize =
llvm::ConstantInt::get(IGM.SizeTy, getHeapHeaderSize(IGM).getValue());
auto *heapHeaderSize = llvm::ConstantInt::get(
IGM.SizeTy, IGM.RefCountedStructSize.getValue());
auto *startOffset =
Builder.CreateAnd(Builder.CreateAdd(heapHeaderSize, alignmentMask),
Builder.CreateNot(alignmentMask));
Expand Down Expand Up @@ -820,7 +820,7 @@ getCopyOutOfLineBoxPointerFunction(IRGenModule &IGM,
IGF.Builder.CreateStore(ptr, dest);
auto *alignmentMask = fixedTI.getStaticAlignmentMask(IGM);
auto *heapHeaderSize = llvm::ConstantInt::get(
IGM.SizeTy, getHeapHeaderSize(IGM).getValue());
IGM.SizeTy, IGM.RefCountedStructSize.getValue());
auto *startOffset = IGF.Builder.CreateAnd(
IGF.Builder.CreateAdd(heapHeaderSize, alignmentMask),
IGF.Builder.CreateNot(alignmentMask));
Expand Down
5 changes: 4 additions & 1 deletion lib/IRGen/IRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,11 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
});
FullBoxMetadataPtrTy = FullBoxMetadataStructTy->getPointerTo(DefaultAS);

llvm::Type *refCountedElts[] = {TypeMetadataPtrTy, Int32Ty, Int32Ty};
// This must match struct HeapObject in the runtime.
llvm::Type *refCountedElts[] = {TypeMetadataPtrTy, IntPtrTy};
RefCountedStructTy->setBody(refCountedElts);
RefCountedStructSize =
Size(DataLayout.getStructLayout(RefCountedStructTy)->getSizeInBytes());

PtrSize = Size(DataLayout.getPointerSize(DefaultAS));

Expand Down
1 change: 1 addition & 0 deletions lib/IRGen/IRGenModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ class IRGenModule {
llvm::PointerType *WitnessTablePtrTy;
};
llvm::StructType *RefCountedStructTy;/// %swift.refcounted = type { ... }
Size RefCountedStructSize; /// sizeof(%swift.refcounted)
llvm::PointerType *RefCountedPtrTy; /// %swift.refcounted*
llvm::PointerType *WeakReferencePtrTy;/// %swift.weak_reference*
llvm::PointerType *UnownedReferencePtrTy;/// %swift.unowned_reference*
Expand Down
7 changes: 1 addition & 6 deletions lib/IRGen/StructLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ static bool requiresHeapHeader(LayoutKind kind) {
llvm_unreachable("bad layout kind!");
}

/// Return the size of the standard heap header.
Size irgen::getHeapHeaderSize(IRGenModule &IGM) {
return IGM.getPointerSize() + Size(8);
}

/// Perform structure layout on the given types.
StructLayout::StructLayout(IRGenModule &IGM, CanType astTy,
LayoutKind layoutKind,
Expand Down Expand Up @@ -184,7 +179,7 @@ Address ElementLayout::project(IRGenFunction &IGF, Address baseAddr,

void StructLayoutBuilder::addHeapHeader() {
assert(StructFields.empty() && "adding heap header at a non-zero offset");
CurSize = getHeapHeaderSize(IGM);
CurSize = IGM.RefCountedStructSize;
CurAlignment = IGM.getPointerAlignment();
StructFields.push_back(IGM.RefCountedStructTy);
}
Expand Down
2 changes: 0 additions & 2 deletions lib/IRGen/StructLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,6 @@ class StructLayout {
const llvm::Twine &name = "") const;
};

Size getHeapHeaderSize(IRGenModule &IGM);

/// Different policies for accessing a physical field.
enum class FieldAccess : uint8_t {
/// Instance variable offsets are constant.
Expand Down
16 changes: 4 additions & 12 deletions stdlib/public/SwiftShims/HeapObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
#include "System.h"

#define SWIFT_ABI_HEAP_OBJECT_HEADER_SIZE_64 16
// TODO: Should be 8
#define SWIFT_ABI_HEAP_OBJECT_HEADER_SIZE_32 12
#define SWIFT_ABI_HEAP_OBJECT_HEADER_SIZE_32 8

#ifdef __cplusplus
#include <type_traits>
Expand All @@ -39,12 +38,12 @@ typedef struct HeapMetadata HeapMetadata;
InlineRefCounts refCounts

/// The Swift heap-object header.
/// This must match RefCountedStructTy in IRGen.
struct HeapObject {
/// This is always a valid pointer to a metadata object.
HeapMetadata const *metadata;

SWIFT_HEAPOBJECT_NON_OBJC_MEMBERS;
// FIXME: allocate two words of metadata on 32-bit platforms

#ifdef __cplusplus
HeapObject() = default;
Expand Down Expand Up @@ -75,15 +74,8 @@ static_assert(swift::IsTriviallyConstructible<HeapObject>::value,
static_assert(std::is_trivially_destructible<HeapObject>::value,
"HeapObject must be trivially destructible");

// FIXME: small header for 32-bit
//static_assert(sizeof(HeapObject) == 2*sizeof(void*),
// "HeapObject must be two pointers long");
//
static_assert(sizeof(HeapObject) ==
(sizeof(void*) == 8 ? SWIFT_ABI_HEAP_OBJECT_HEADER_SIZE_64 :
sizeof(void*) == 4 ? SWIFT_ABI_HEAP_OBJECT_HEADER_SIZE_32 :
0 && "unexpected pointer size"),
"HeapObject must match ABI heap object header size");
static_assert(sizeof(HeapObject) == 2*sizeof(void*),
"HeapObject must be two pointers long");

static_assert(alignof(HeapObject) == alignof(void*),
"HeapObject must be pointer-aligned");
Expand Down
33 changes: 11 additions & 22 deletions stdlib/public/SwiftShims/RefCount.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@
#include "Visibility.h"
#include "SwiftStdint.h"

#if !defined(__cplusplus)
// This definition is a placeholder for importing into Swift.
// It provides size and alignment but cannot be manipulated safely there.
typedef struct {
__swift_uintptr_t refCounts SWIFT_ATTRIBUTE_UNAVAILABLE;
} InlineRefCountsPlaceholder;

// These definitions are placeholders for importing into Swift.
// They provide size and alignment but cannot be manipulated safely there.
#if !defined(__cplusplus)

typedef struct {
_Alignas(__swift_uintptr_t) __swift_uint32_t refCounts1 SWIFT_ATTRIBUTE_UNAVAILABLE;
__swift_uint32_t refCounts2 SWIFT_ATTRIBUTE_UNAVAILABLE;
} InlineRefCounts;
typedef InlineRefCountsPlaceholder InlineRefCounts;

// not __cplusplus
#else
// __cplusplus

#include <type_traits>
#include <atomic>
Expand Down Expand Up @@ -733,11 +731,6 @@ class SideTableRefCountBits : public RefCountBitsT<RefCountNotInline>
template <typename RefCountBits>
class RefCounts {
std::atomic<RefCountBits> refCounts;
#if __POINTER_WIDTH__ == 32
// FIXME: hack - something somewhere is assuming a 3-word header on 32-bit
// See also other fixmes marked "small header for 32-bit"
uintptr_t : 32;
#endif

// Out-of-line slow paths.

Expand Down Expand Up @@ -1572,15 +1565,11 @@ typedef swift::InlineRefCounts InlineRefCounts;
#endif

// These assertions apply to both the C and the C++ declarations.
_Static_assert(_Alignof(InlineRefCounts) == _Alignof(__swift_uintptr_t),
"InlineRefCounts must be pointer-aligned");
// FIXME: small header for 32-bit
#if 0
_Static_assert(sizeof(InlineRefCounts) == sizeof(InlineRefCountsPlaceholder),
"InlineRefCounts and InlineRefCountsPlaceholder must match");
_Static_assert(sizeof(InlineRefCounts) == sizeof(__swift_uintptr_t),
"InlineRefCounts must be pointer-sized");
#else
_Static_assert(sizeof(InlineRefCounts) == 2*sizeof(__swift_uint32_t),
"InlineRefCounts must be 8 bytes");
#endif
_Static_assert(_Alignof(InlineRefCounts) == _Alignof(__swift_uintptr_t),
"InlineRefCounts must be pointer-aligned");

#endif
10 changes: 5 additions & 5 deletions test/IRGen/class_resilience.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
// CHECK: @_T016class_resilience33ClassWithResilientlySizedPropertyC1r16resilient_struct9RectangleVvpWvd = {{(protected )?}}global [[INT]] 0
// CHECK: @_T016class_resilience33ClassWithResilientlySizedPropertyC5colors5Int32VvpWvd = {{(protected )?}}global [[INT]] 0

// CHECK: @_T016class_resilience14ResilientChildC5fields5Int32VvpWvd = {{(protected )?}}global [[INT]] {{12|16}}
// CHECK: @_T016class_resilience14ResilientChildC5fields5Int32VvpWvd = {{(protected )?}}global [[INT]] {{8|16}}
// CHECK: @_T016class_resilience21ResilientGenericChildC5fields5Int32VvpWvi = {{(protected )?}}global [[INT]] {{56|88}}

// CHECK: @_T016class_resilience28ClassWithMyResilientPropertyC1rAA0eF6StructVvpWvd = {{(protected )?}}constant [[INT]] {{12|16}}
// CHECK: @_T016class_resilience28ClassWithMyResilientPropertyC5colors5Int32VvpWvd = {{(protected )?}}constant [[INT]] {{16|20}}
// CHECK: @_T016class_resilience28ClassWithMyResilientPropertyC1rAA0eF6StructVvpWvd = {{(protected )?}}constant [[INT]] {{8|16}}
// CHECK: @_T016class_resilience28ClassWithMyResilientPropertyC5colors5Int32VvpWvd = {{(protected )?}}constant [[INT]] {{12|20}}

// CHECK: @_T016class_resilience30ClassWithIndirectResilientEnumC1s14resilient_enum10FunnyShapeOvpWvd = {{(protected )?}}constant [[INT]] {{12|16}}
// CHECK: @_T016class_resilience30ClassWithIndirectResilientEnumC5colors5Int32VvpWvd = {{(protected )?}}constant [[INT]] {{16|24}}
// CHECK: @_T016class_resilience30ClassWithIndirectResilientEnumC1s14resilient_enum10FunnyShapeOvpWvd = {{(protected )?}}constant [[INT]] {{8|16}}
// CHECK: @_T016class_resilience30ClassWithIndirectResilientEnumC5colors5Int32VvpWvd = {{(protected )?}}constant [[INT]] {{12|24}}

import resilient_class
import resilient_struct
Expand Down
10 changes: 5 additions & 5 deletions test/IRGen/existentials_opaque_boxed.sil
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ entry:
// CHECK: [[CONTAINER:%.*]] = alloca %T25existentials_opaque_boxed11ExistentialP
// CHECK: [[INLINEBUFFER:%.*]] = getelementptr inbounds %T25existentials_opaque_boxed11ExistentialP, %T25existentials_opaque_boxed11ExistentialP* [[CONTAINER]], i32 0, i32 0
// CHECK: [[INLINEBUFFER:%.*]] = getelementptr inbounds %T25existentials_opaque_boxed11ExistentialP, %T25existentials_opaque_boxed11ExistentialP* [[CONTAINER]], i32 0, i32 0
// CHECK: [[BOX:%.*]] = call noalias %swift.refcounted* @swift_rt_swift_allocObject(%swift.type* getelementptr inbounds (%swift.full_boxmetadata, %swift.full_boxmetadata* @metadata, i32 0, i32 2), {{(i64|i32)}} 48, {{(i64|i32)}} 7)
// CHECK: [[BOX:%.*]] = call noalias %swift.refcounted* @swift_rt_swift_allocObject(%swift.type* getelementptr inbounds (%swift.full_boxmetadata, %swift.full_boxmetadata* @metadata, i32 0, i32 2), {{(i64 48|i32 40)}}, {{(i64|i32)}} 7)
// CHECK: [[BOX_ADDR:%.*]] = bitcast %swift.refcounted* [[BOX]] to <{ %swift.refcounted{{(, \[4 x i8\])?}}, [32 x i8] }>*
// CHECK: [[VALUE_ADDR:%.*]] = getelementptr inbounds <{ %swift.refcounted{{(, \[4 x i8\])?}}, [32 x i8] }>, <{ %swift.refcounted{{(, \[4 x i8\])?}}, [32 x i8] }>* [[BOX_ADDR]], i32 0, i32 {{(1|2)}}
// CHECK: [[INIT_EXIST_ADDR:%.*]] = bitcast [32 x i8]* [[VALUE_ADDR]] to %T25existentials_opaque_boxed14NotInlineFixedV*
Expand Down Expand Up @@ -136,7 +136,7 @@ entry:
// CHECK: [[VW2:%.*]] = load i8*, i8** [[VW_ADDR2]]
// CHECK: [[SIZE:%.*]] = ptrtoint i8* [[VW2]] to {{(i64|i32)}}
// CHECK: [[ALIGNMASK:%.*]] = and {{(i64|i32)}} [[FLAGS]], 65535
// CHECK: [[HEADERSIZEPLUSALIGN:%.*]] = add {{(i64|i32)}} {{(16|12)}}, [[ALIGNMASK]]
// CHECK: [[HEADERSIZEPLUSALIGN:%.*]] = add {{(i64 16|i32 8)}}, [[ALIGNMASK]]
// CHECK: [[NOTALIGNMASK:%.*]] = xor {{(i64|i32)}} [[ALIGNMASK]], -1
// CHECK: [[ALIGNEDSTART:%.*]] = and {{(i64|i32)}} [[HEADERSIZEPLUSALIGN]], [[NOTALIGNMASK]]
// CHECK: [[HEAPSIZE:%.*]] = add {{(i64|i32)}} [[ALIGNEDSTART]], [[SIZE]]
Expand Down Expand Up @@ -179,7 +179,7 @@ bb0(%0 : $*Existential):
// CHECK: [[REFADDR:%.*]] = bitcast [{{(24|12)}} x i8]* %0 to %swift.refcounted**
// CHECK: [[REF:%.*]] = load %swift.refcounted*, %swift.refcounted** [[REFADDR]]
// CHECK: [[ALIGNMASK:%.*]] = and {{(i64|i32)}} [[FLAGS]], 65535
// CHECK: [[HEADERSIZEPLUSALIGN:%.*]] = add {{(i64|i32)}} {{(16|12)}}, [[ALIGNMASK]]
// CHECK: [[HEADERSIZEPLUSALIGN:%.*]] = add {{(i64 16|i32 8)}}, [[ALIGNMASK]]
// CHECK: [[NOTALIGNMASK:%.*]] = xor {{(i64|i32)}} [[ALIGNMASK]], -1
// CHECK: [[ALIGNEDSTART:%.*]] = and {{(i64|i32)}} [[HEADERSIZEPLUSALIGN]], [[NOTALIGNMASK]]
// CHECK: [[HEAPOBJ:%.*]] = bitcast %swift.refcounted* %9 to i8*
Expand Down Expand Up @@ -519,8 +519,8 @@ struct FixedOveralign : Existential {
// CHECK: [[INLINEBUFFER:%.*]] = getelementptr inbounds %T25existentials_opaque_boxed11ExistentialP, %T25existentials_opaque_boxed11ExistentialP* [[CONTAINER]], i32 0, i32 0
// CHECK: [[INLINEBUFFER:%.*]] = getelementptr inbounds %T25existentials_opaque_boxed11ExistentialP, %T25existentials_opaque_boxed11ExistentialP* [[CONTAINER]], i32 0, i32 0
// CHECK: [[BOX:%.*]] = call noalias %swift.refcounted* @swift_rt_swift_allocObject(%swift.type* getelementptr inbounds (%swift.full_boxmetadata, %swift.full_boxmetadata* @metadata.3, i32 0, i32 2), {{(i64|i32)}} 64, {{(i64|i32)}} 31)
// CHECK: [[BOX_ADDR:%.*]] = bitcast %swift.refcounted* [[BOX]] to <{ %swift.refcounted, [{{(20|16)}} x i8], [32 x i8] }>*
// CHECK: [[VALUE_ADDR:%.*]] = getelementptr inbounds <{ %swift.refcounted, [{{(20|16)}} x i8], [32 x i8] }>, <{ %swift.refcounted, [{{(20|16)}} x i8], [32 x i8] }>* [[BOX_ADDR]], i32 0, i32 {{(1|2)}}
// CHECK: [[BOX_ADDR:%.*]] = bitcast %swift.refcounted* [[BOX]] to <{ %swift.refcounted, [{{(16|24)}} x i8], [32 x i8] }>*
// CHECK: [[VALUE_ADDR:%.*]] = getelementptr inbounds <{ %swift.refcounted, [{{(16|24)}} x i8], [32 x i8] }>, <{ %swift.refcounted, [{{(16|24)}} x i8], [32 x i8] }>* [[BOX_ADDR]], i32 0, i32 {{(1|2)}}
// CHECK: [[INIT_EXIST_ADDR:%.*]] = bitcast [32 x i8]* [[VALUE_ADDR]] to %T25existentials_opaque_boxed14FixedOveralignV*
// CHECK: [[INLINEBUFFER_ADDR:%.*]] = bitcast [{{(24|12)}} x i8]* [[INLINEBUFFER]] to %swift.refcounted**
// CHECK: store %swift.refcounted* [[BOX]], %swift.refcounted** [[INLINEBUFFER_ADDR]]
Expand Down
8 changes: 4 additions & 4 deletions test/IRGen/literals.sil
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
// CHECK: [[U16_0:@.*]] = private unnamed_addr constant [8 x i16] [i16 104, i16 101, i16 108, i16 112, i16 9, i16 109, i16 101, i16 0]
// CHECK: [[U16_1:@.*]] = private unnamed_addr constant [4 x i16] [i16 0, i16 120, i16 427, i16 0]
// CHECK: @_T0s19_UTF16StringStorageCN = external global %objc_class
// CHECK: [[UTF16_CSTR_0:@.*]] = private unnamed_addr constant { %swift.refcounted, i32, i32, i8, i8, [8 x i16] } { %swift.refcounted { %swift.type* bitcast (%objc_class* @_T0s19_UTF16StringStorageCN to %swift.type*), i32 4, i32 0 }, i32 7, i32 8, i8 0, i8 0, [8 x i16] [i16 104, i16 101, i16 108, i16 112, i16 9, i16 109, i16 101, i16 0] }
// CHECK: [[UTF16_CSTR_1:@.*]] = private unnamed_addr constant { %swift.refcounted, i32, i32, i8, i8, [9 x i16] } { %swift.refcounted { %swift.type* bitcast (%objc_class* @_T0s19_UTF16StringStorageCN to %swift.type*), i32 4, i32 0 }, i32 8, i32 9, i8 0, i8 0, [9 x i16] [i16 104, i16 101, i16 108, i16 112, i16 9, i16 109, i16 101, i16 0, i16 0] }
// CHECK: [[UTF16_CSTR_0:@.*]] = private unnamed_addr constant { %swift.refcounted, i32, i32, i8, i8, [8 x i16] } { %swift.refcounted { %swift.type* bitcast (%objc_class* @_T0s19_UTF16StringStorageCN to %swift.type*), i64 8589934594 }, i32 7, i32 8, i8 0, i8 0, [8 x i16] [i16 104, i16 101, i16 108, i16 112, i16 9, i16 109, i16 101, i16 0] }
// CHECK: [[UTF16_CSTR_1:@.*]] = private unnamed_addr constant { %swift.refcounted, i32, i32, i8, i8, [9 x i16] } { %swift.refcounted { %swift.type* bitcast (%objc_class* @_T0s19_UTF16StringStorageCN to %swift.type*), i64 8589934594 }, i32 8, i32 9, i8 0, i8 0, [9 x i16] [i16 104, i16 101, i16 108, i16 112, i16 9, i16 109, i16 101, i16 0, i16 0] }
// CHECK: @_T0s20_Latin1StringStorageCN = external global %objc_class
// CHECK: [[CSTR_0:@.*]] = private unnamed_addr constant { %swift.refcounted, i32, i32, i8, [12 x i8] } { %swift.refcounted { %swift.type* bitcast (%objc_class* @_T0s20_Latin1StringStorageCN to %swift.type*), i32 4, i32 0 }, i32 11, i32 12, i8 0, [12 x i8] c"help\09me too\00" }
// CHECK: [[CSTR_1:@.*]] = private unnamed_addr constant { %swift.refcounted, i32, i32, i8, [13 x i8] } { %swift.refcounted { %swift.type* bitcast (%objc_class* @_T0s20_Latin1StringStorageCN to %swift.type*), i32 4, i32 0 }, i32 12, i32 13, i8 0, [13 x i8] c"help\09me too\00\00" }
// CHECK: [[CSTR_0:@.*]] = private unnamed_addr constant { %swift.refcounted, i32, i32, i8, [12 x i8] } { %swift.refcounted { %swift.type* bitcast (%objc_class* @_T0s20_Latin1StringStorageCN to %swift.type*), i64 8589934594 }, i32 11, i32 12, i8 0, [12 x i8] c"help\09me too\00" }
// CHECK: [[CSTR_1:@.*]] = private unnamed_addr constant { %swift.refcounted, i32, i32, i8, [13 x i8] } { %swift.refcounted { %swift.type* bitcast (%objc_class* @_T0s20_Latin1StringStorageCN to %swift.type*), i64 8589934594 }, i32 12, i32 13, i8 0, [13 x i8] c"help\09me too\00\00" }

sil_stage canonical

Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/objc_class_empty_fields.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// SR-1055

// CHECK-64: @_DATA__TtC23objc_class_empty_fields14OneEnumWrapper = private constant { {{.*}}* } { i32 {{[0-9]+}}, i32 16, i32 24
// CHECK-32: @_DATA__TtC23objc_class_empty_fields14OneEnumWrapper = private constant { {{.*}}* } { i32 {{[0-9]+}}, i32 12, i32 16
// CHECK-32: @_DATA__TtC23objc_class_empty_fields14OneEnumWrapper = private constant { {{.*}}* } { i32 {{[0-9]+}}, i32 8, i32 12

enum OneCaseEnum {
case X
Expand Down
Loading