Skip to content

Commit a0d9c23

Browse files
authored
Merge pull request #15184 from adrian-prantl/38324861
2 parents aa1059c + 6663462 commit a0d9c23

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,14 +1251,15 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
12511251
case TypeKind::BuiltinVector: {
12521252
(void)MangledName; // FIXME emit the name somewhere.
12531253
auto *BuiltinVectorTy = BaseTy->castTo<BuiltinVectorType>();
1254-
DebugTypeInfo ElemDbgTy(DbgTy.getDeclContext(),
1255-
DbgTy.getGenericEnvironment(),
1256-
BuiltinVectorTy->getElementType(),
1257-
DbgTy.StorageType, DbgTy.size, DbgTy.align, true);
1258-
auto Subscripts = nullptr;
1259-
return DBuilder.createVectorType(BuiltinVectorTy->getNumElements(),
1254+
auto ElemTy = BuiltinVectorTy->getElementType();
1255+
auto ElemDbgTy = DebugTypeInfo::getFromTypeInfo(
1256+
DbgTy.getDeclContext(), DbgTy.getGenericEnvironment(), ElemTy,
1257+
IGM.getTypeInfoForUnlowered(ElemTy));
1258+
unsigned Count = BuiltinVectorTy->getNumElements();
1259+
auto Subscript = DBuilder.getOrCreateSubrange(0, Count ? Count : -1);
1260+
return DBuilder.createVectorType(SizeInBits,
12601261
AlignInBits, getOrCreateType(ElemDbgTy),
1261-
Subscripts);
1262+
DBuilder.getOrCreateArray(Subscript));
12621263
}
12631264

12641265
// Reference storage types.

test/DebugInfo/vector.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %target-swift-frontend -emit-ir -g %s -o - -parse-stdlib | %FileCheck %s
2+
// REQUIRES: OS=macosx
3+
4+
// CHECK: !DICompositeType(tag: DW_TAG_array_type, baseType: ![[FLOAT:[0-9]+]], size: 64, flags: DIFlagVector, elements: ![[ELTS:[0-9]+]])
5+
// CHECK: ![[FLOAT]] = !DIBasicType(name: "$SBf32_D", size: 32, encoding: DW_ATE_float)
6+
// CHECK: ![[ELTS]] = !{![[SR:[0-9]+]]}
7+
// CHECK: ![[SR]] = !DISubrange(count: 2)
8+
9+
10+
import Swift
11+
public struct float2 {
12+
public var _vector: Builtin.Vec2xFPIEEE32
13+
public subscript(index: Int) -> Float {
14+
get {
15+
let elt = Builtin.extractelement_Vec2xFPIEEE32_Int32(_vector,
16+
Int32(index)._value)
17+
return Float(_bits: elt)
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)