Skip to content

Debug Info: Fix the emission of vector types. #15184

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
merged 1 commit into from
Mar 12, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 8 additions & 7 deletions lib/IRGen/IRGenDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1251,14 +1251,15 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
case TypeKind::BuiltinVector: {
(void)MangledName; // FIXME emit the name somewhere.
auto *BuiltinVectorTy = BaseTy->castTo<BuiltinVectorType>();
DebugTypeInfo ElemDbgTy(DbgTy.getDeclContext(),
DbgTy.getGenericEnvironment(),
BuiltinVectorTy->getElementType(),
DbgTy.StorageType, DbgTy.size, DbgTy.align, true);
auto Subscripts = nullptr;
return DBuilder.createVectorType(BuiltinVectorTy->getNumElements(),
auto ElemTy = BuiltinVectorTy->getElementType();
auto ElemDbgTy = DebugTypeInfo::getFromTypeInfo(
DbgTy.getDeclContext(), DbgTy.getGenericEnvironment(), ElemTy,
IGM.getTypeInfoForUnlowered(ElemTy));
unsigned Count = BuiltinVectorTy->getNumElements();
auto Subscript = DBuilder.getOrCreateSubrange(0, Count ? Count : -1);
return DBuilder.createVectorType(SizeInBits,
AlignInBits, getOrCreateType(ElemDbgTy),
Subscripts);
DBuilder.getOrCreateArray(Subscript));
}

// Reference storage types.
Expand Down
20 changes: 20 additions & 0 deletions test/DebugInfo/vector.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// RUN: %target-swift-frontend -emit-ir -g %s -o - -parse-stdlib | %FileCheck %s
// REQUIRES: OS=macosx

// CHECK: !DICompositeType(tag: DW_TAG_array_type, baseType: ![[FLOAT:[0-9]+]], size: 64, flags: DIFlagVector, elements: ![[ELTS:[0-9]+]])
// CHECK: ![[FLOAT]] = !DIBasicType(name: "$SBf32_D", size: 32, encoding: DW_ATE_float)
// CHECK: ![[ELTS]] = !{![[SR:[0-9]+]]}
// CHECK: ![[SR]] = !DISubrange(count: 2)


import Swift
public struct float2 {
public var _vector: Builtin.Vec2xFPIEEE32
public subscript(index: Int) -> Float {
get {
let elt = Builtin.extractelement_Vec2xFPIEEE32_Int32(_vector,
Int32(index)._value)
return Float(_bits: elt)
}
}
}